forge
Explore
Log in

Don't you dare go Hollow

Show seconds also applies to the builder's edit history, search hits and forwarded snippets

Browse files at this commit

3255a09d6323b55b76498ea0c1bbcf0063663a5aAhmet Kaan GümüşParent: 7f93e5a
  • style
    • Show seconds also applies to the builder's edit history, search hits and forwarded snippets
    • Settings::clock() is now the only reader of CLOCK
Show full message
💄 style: Show seconds also applies to the builder's edit history, search hits and forwarded snippets; Settings::clock() is now the only reader of CLOCK
crates/client/src/gui/chat.rsmodified+9 -2
@@ -1727,7 +1727,14 @@ impl Yumush {
1727 .children(1727 .children(
1728 community1728 community
1729 .is_some_and(|community| self.chat.joined(community.id))1729 .is_some_and(|community| self.chat.joined(community.id))
1730- .then(|| message_actions::search_popover(&self.chat, entity, palette)),1730+ .then(|| {
1731+ message_actions::search_popover(
1732+ &self.chat,
1733+ self.settings.clock(),
1734+ entity,
1735+ palette,
1736+ )
1737+ }),
1731 )1738 )
1732 .children(1739 .children(
1733 (community.is_some() && !self.chat.pins.is_empty())1740 (community.is_some() && !self.chat.pins.is_empty())
@@ -3717,7 +3724,7 @@ fn render_message(
3717 entity,3724 entity,
3718 palette,3725 palette,
3719 ))3726 ))
3720- .children(snippet::snippet_card(message, chat, entity, palette))3727+ .children(snippet::snippet_card(message, clock, chat, entity, palette))
3721 .children(message.poll.as_ref().map(|poll| {3728 .children(message.poll.as_ref().map(|poll| {
3722 poll::poll_card(3729 poll::poll_card(
3723 poll,3730 poll,
crates/client/src/gui/message_actions.rsmodified+12 -6
@@ -20,7 +20,7 @@ use gpui_kit::{
20 };20 };
21 21
22 use super::{22 use super::{
23- CLOCK, Palette, Trigger, Yumush, avatar,23+ Palette, Trigger, Yumush, avatar,
24 chat::{Chat, ReportTarget},24 chat::{Chat, ReportTarget},
25 clickable,25 clickable,
26 composer::trigger_icon,26 composer::trigger_icon,
@@ -278,8 +278,9 @@ pub fn edited_mark(
278 .child(w().chat.edited),278 .child(w().chat.edited),
279 ))279 ))
280 .content(move |_, _, cx| {280 .content(move |_, _, cx| {
281- let mut edits = content281+ let yumush = content.read(cx);
282- .read(cx)282+ let clock = yumush.settings.clock();
283+ let mut edits = yumush
283 .chat284 .chat
284 .edits285 .edits
285 .get(&message_id)286 .get(&message_id)
@@ -301,7 +302,7 @@ pub fn edited_mark(
301 div()302 div()
302 .flex_shrink_0()303 .flex_shrink_0()
303 .text_color(palette.muted)304 .text_color(palette.muted)
304- .child(millis_time(edit.edited_at, CLOCK)),305+ .child(millis_time(edit.edited_at, clock)),
305 )306 )
306 .child(div().min_w_0().child(edit.body))307 .child(div().min_w_0().child(edit.body))
307 }))308 }))
@@ -385,7 +386,12 @@ fn person_row(
385 .text_size(text(text::CAPTION))386 .text_size(text(text::CAPTION))
386 }387 }
387 388
388-pub fn search_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement {389+pub fn search_popover(
390+ chat: &Chat,
391+ clock: &'static str,
392+ entity: &Entity<Yumush>,
393+ palette: Palette,
394+) -> impl IntoElement {
389 let entity = entity.clone();395 let entity = entity.clone();
390 let input = chat.community_search.clone();396 let input = chat.community_search.clone();
391 let hits: Vec<Hit> = chat397 let hits: Vec<Hit> = chat
@@ -398,7 +404,7 @@ pub fn search_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) ->
398 .as_ref()404 .as_ref()
399 .map(|user| user.username.clone())405 .map(|user| user.username.clone())
400 .unwrap_or_default(),406 .unwrap_or_default(),
401- time: Some(millis_time(hit.message.created_at, CLOCK)),407+ time: Some(millis_time(hit.message.created_at, clock)),
402 body: message_text(&hit.message),408 body: message_text(&hit.message),
403 })409 })
404 .collect();410 .collect();
crates/client/src/gui/snippet.rsmodified+4 -3
@@ -1,5 +1,4 @@
1 use super::style::{size, space, text};1 use super::style::{size, space, text};
2-use crate::gui::CLOCK;
3 use crate::lang::w;2 use crate::lang::w;
4 use common::model::{Message, Role, SnippetMessage, User};3 use common::model::{Message, Role, SnippetMessage, User};
5 use gpui_kit::{4 use gpui_kit::{
@@ -14,6 +13,7 @@ use super::{
14 13
15 pub fn snippet_card(14 pub fn snippet_card(
16 message: &Message,15 message: &Message,
16+ clock: &'static str,
17 chat: &Chat,17 chat: &Chat,
18 entity: &Entity<Yumush>,18 entity: &Entity<Yumush>,
19 palette: Palette,19 palette: Palette,
@@ -40,13 +40,14 @@ pub fn snippet_card(
40 snippet40 snippet
41 .messages41 .messages
42 .iter()42 .iter()
43- .map(|item| snippet_row(item, chat, entity, palette)),43+ .map(|item| snippet_row(item, clock, chat, entity, palette)),
44 ),44 ),
45 )45 )
46 }46 }
47 47
48 fn snippet_row(48 fn snippet_row(
49 item: &SnippetMessage,49 item: &SnippetMessage,
50+ clock: &'static str,
50 chat: &Chat,51 chat: &Chat,
51 entity: &Entity<Yumush>,52 entity: &Entity<Yumush>,
52 palette: Palette,53 palette: Palette,
@@ -101,7 +102,7 @@ fn snippet_row(
101 div()102 div()
102 .text_size(super::text(text::CAPTION))103 .text_size(super::text(text::CAPTION))
103 .text_color(palette.muted)104 .text_color(palette.muted)
104- .child(millis_time(item.created_at, CLOCK)),105+ .child(millis_time(item.created_at, clock)),
105 ),106 ),
106 )107 )
107 .when(!item.body.is_empty(), |this| {108 .when(!item.body.is_empty(), |this| {