diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index ec20123..94cd003 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -256,6 +256,7 @@ pub struct Chat { pub(super) pending_message_delete: Option, pub(super) hover_row: Option, pub(super) hover_bar: Option, + pub(super) reacting: Option, pub(super) pending_builder_purge: Option, pub(super) transfer: Option, pub(super) voice: HashMap>, @@ -506,6 +507,7 @@ impl Chat { pending_message_delete: None, hover_row: None, hover_bar: None, + reacting: None, pending_builder_purge: None, transfer: None, builder_password, @@ -949,6 +951,10 @@ impl Chat { self.scroll.max_offset().y + self.scroll.offset().y > self.scroll.bounds().size.height } + pub(super) fn engaged(&self, message_id: Id) -> bool { + self.hover_bar == Some(message_id) || self.reacting == Some(message_id) + } + pub(super) fn jump_to_bottom(&mut self) { self.scroll.scroll_to_bottom(); self.unseen = 0; @@ -3559,9 +3565,7 @@ fn render_message( .flex_col() .min_w_0() .hover(|style| style.bg(palette.hover)) - .when(chat.hover_bar == Some(message.id), |this| { - this.bg(palette.hover) - }) + .when(chat.engaged(message.id), |this| this.bg(palette.hover)) .when(first && spaced && !selecting, |this| this.mt(px(space::LG))) .when(highlighted, |this| this.bg(palette.tokens.press())) .when(mentioned, |this| { diff --git a/crates/client/src/gui/message_actions.rs b/crates/client/src/gui/message_actions.rs index 8dc9754..5175b0f 100644 --- a/crates/client/src/gui/message_actions.rs +++ b/crates/client/src/gui/message_actions.rs @@ -90,9 +90,17 @@ pub fn react_popover( ) -> impl IntoElement { let message_id = message.id; let entity = entity.clone(); + let reacting = entity.clone(); Popover::new(format!("react_{}", message.id)) .anchor(Anchor::BottomRight) + .on_open_change(move |open, _, cx| { + reacting.update(cx, |yumush, cx| { + if track(&mut yumush.chat.reacting, message_id, *open) { + cx.notify(); + } + }); + }) .appearance(false) .trigger(trigger_icon( format!("react_trigger_{}", message.id), @@ -418,7 +426,7 @@ pub fn actions( let reportable = me.is_some_and(|me| me.id != message.user_id); let id = message.id; let armed = chat.pending_message_delete == Some(id); - let shown = armed || chat.hover_row == Some(id) || chat.hover_bar == Some(id); + let shown = armed || chat.hover_row == Some(id) || chat.engaged(id); let hover = entity.clone(); panel(palette)