update components
This commit is contained in:
@@ -26,11 +26,10 @@ use state::NostrRegistry;
|
||||
use theme::ActiveTheme;
|
||||
use ui::avatar::Avatar;
|
||||
use ui::button::{Button, ButtonVariants};
|
||||
use ui::context_menu::ContextMenuExt;
|
||||
use ui::indicator::Indicator;
|
||||
use ui::input::{InputEvent, InputState, TextInput};
|
||||
use ui::menu::{ContextMenuExt, DropdownMenu};
|
||||
use ui::notification::Notification;
|
||||
use ui::popup_menu::PopupMenuExt;
|
||||
use ui::{
|
||||
h_flex, v_flex, Disableable, Icon, IconName, InteractiveElementExt, Sizable, StyledExt,
|
||||
WindowExtension,
|
||||
@@ -392,7 +391,15 @@ impl ChatPanel {
|
||||
self.reports_by_id
|
||||
.read_blocking()
|
||||
.get(id)
|
||||
.is_some_and(|reports| reports.iter().all(|r| r.success()))
|
||||
.is_some_and(|reports| reports.iter().any(|r| r.success()))
|
||||
}
|
||||
|
||||
/// Check if a message failed to send by its ID
|
||||
fn sent_failed(&self, id: &EventId) -> bool {
|
||||
self.reports_by_id
|
||||
.read_blocking()
|
||||
.get(id)
|
||||
.is_some_and(|reports| reports.iter().all(|r| !r.success()))
|
||||
}
|
||||
|
||||
/// Get all sent reports for a message by its ID
|
||||
@@ -622,6 +629,9 @@ impl ChatPanel {
|
||||
// Check if message is sent successfully
|
||||
let sent_success = self.sent_success(&id);
|
||||
|
||||
// Check if message is sent failed
|
||||
let sent_failed = self.sent_failed(&id);
|
||||
|
||||
// Hide avatar setting
|
||||
let hide_avatar = AppSettings::get_hide_avatar(cx);
|
||||
|
||||
@@ -679,7 +689,7 @@ impl ChatPanel {
|
||||
this.children(self.render_message_replies(replies, cx))
|
||||
})
|
||||
.child(rendered_text)
|
||||
.when(!sent_success, |this| {
|
||||
.when(sent_failed, |this| {
|
||||
this.child(deferred(self.render_message_reports(&id, cx)))
|
||||
}),
|
||||
),
|
||||
@@ -966,9 +976,9 @@ impl ChatPanel {
|
||||
.icon(IconName::Ellipsis)
|
||||
.small()
|
||||
.ghost()
|
||||
.popup_menu({
|
||||
.dropdown_menu({
|
||||
let id = id.to_owned();
|
||||
move |this, _, _| this.menu("Seen on", Box::new(SeenOn(id)))
|
||||
move |this, _window, _cx| this.menu("Seen on", Box::new(SeenOn(id)))
|
||||
}),
|
||||
)
|
||||
.group_hover("", |this| this.visible())
|
||||
@@ -1152,7 +1162,8 @@ impl Render for ChatPanel {
|
||||
this.render_message(ix, window, cx)
|
||||
}),
|
||||
)
|
||||
.flex_1(),
|
||||
.flex_1()
|
||||
.size_full(),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
@@ -1192,10 +1203,10 @@ impl Render for ChatPanel {
|
||||
.icon(IconName::Emoji)
|
||||
.ghost()
|
||||
.large()
|
||||
.popup_menu_with_anchor(
|
||||
.dropdown_menu_with_anchor(
|
||||
gpui::Corner::BottomLeft,
|
||||
move |this, _window, _cx| {
|
||||
this.axis(gpui::Axis::Horizontal)
|
||||
this//.axis(gpui::Axis::Horizontal)
|
||||
.menu("👍", Box::new(Command::Insert("👍")))
|
||||
.menu("👎", Box::new(Command::Insert("👎")))
|
||||
.menu("😄", Box::new(Command::Insert("😄")))
|
||||
|
||||
Reference in New Issue
Block a user