diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index e478e1b..b892f67 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -1727,7 +1727,14 @@ impl Yumush { .children( community .is_some_and(|community| self.chat.joined(community.id)) - .then(|| message_actions::search_popover(&self.chat, entity, palette)), + .then(|| { + message_actions::search_popover( + &self.chat, + self.settings.clock(), + entity, + palette, + ) + }), ) .children( (community.is_some() && !self.chat.pins.is_empty()) @@ -3717,7 +3724,7 @@ fn render_message( entity, palette, )) - .children(snippet::snippet_card(message, chat, entity, palette)) + .children(snippet::snippet_card(message, clock, chat, entity, palette)) .children(message.poll.as_ref().map(|poll| { poll::poll_card( poll, diff --git a/crates/client/src/gui/message_actions.rs b/crates/client/src/gui/message_actions.rs index a8b7a80..a9c6dc9 100644 --- a/crates/client/src/gui/message_actions.rs +++ b/crates/client/src/gui/message_actions.rs @@ -20,7 +20,7 @@ use gpui_kit::{ }; use super::{ - CLOCK, Palette, Trigger, Yumush, avatar, + Palette, Trigger, Yumush, avatar, chat::{Chat, ReportTarget}, clickable, composer::trigger_icon, @@ -278,8 +278,9 @@ pub fn edited_mark( .child(w().chat.edited), )) .content(move |_, _, cx| { - let mut edits = content - .read(cx) + let yumush = content.read(cx); + let clock = yumush.settings.clock(); + let mut edits = yumush .chat .edits .get(&message_id) @@ -301,7 +302,7 @@ pub fn edited_mark( div() .flex_shrink_0() .text_color(palette.muted) - .child(millis_time(edit.edited_at, CLOCK)), + .child(millis_time(edit.edited_at, clock)), ) .child(div().min_w_0().child(edit.body)) })) @@ -385,7 +386,12 @@ fn person_row( .text_size(text(text::CAPTION)) } -pub fn search_popover(chat: &Chat, entity: &Entity, palette: Palette) -> impl IntoElement { +pub fn search_popover( + chat: &Chat, + clock: &'static str, + entity: &Entity, + palette: Palette, +) -> impl IntoElement { let entity = entity.clone(); let input = chat.community_search.clone(); let hits: Vec = chat @@ -398,7 +404,7 @@ pub fn search_popover(chat: &Chat, entity: &Entity, palette: Palette) -> .as_ref() .map(|user| user.username.clone()) .unwrap_or_default(), - time: Some(millis_time(hit.message.created_at, CLOCK)), + time: Some(millis_time(hit.message.created_at, clock)), body: message_text(&hit.message), }) .collect(); diff --git a/crates/client/src/gui/snippet.rs b/crates/client/src/gui/snippet.rs index f99ed8e..9e2ef07 100644 --- a/crates/client/src/gui/snippet.rs +++ b/crates/client/src/gui/snippet.rs @@ -1,5 +1,4 @@ use super::style::{size, space, text}; -use crate::gui::CLOCK; use crate::lang::w; use common::model::{Message, Role, SnippetMessage, User}; use gpui_kit::{ @@ -14,6 +13,7 @@ use super::{ pub fn snippet_card( message: &Message, + clock: &'static str, chat: &Chat, entity: &Entity, palette: Palette, @@ -40,13 +40,14 @@ pub fn snippet_card( snippet .messages .iter() - .map(|item| snippet_row(item, chat, entity, palette)), + .map(|item| snippet_row(item, clock, chat, entity, palette)), ), ) } fn snippet_row( item: &SnippetMessage, + clock: &'static str, chat: &Chat, entity: &Entity, palette: Palette, @@ -101,7 +102,7 @@ fn snippet_row( div() .text_size(super::text(text::CAPTION)) .text_color(palette.muted) - .child(millis_time(item.created_at, CLOCK)), + .child(millis_time(item.created_at, clock)), ), ) .when(!item.body.is_empty(), |this| {