diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index cafc818..303c96a 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -3536,143 +3536,145 @@ fn render_message( .as_ref() .is_some_and(|(id, at)| id == &message.id && at.elapsed() < HIGHLIGHT_TTL); - let row = - div() - .id(format!("message_row_{}", message.id)) - .group(group.clone()) - .relative() - .flex() - .flex_col() - .min_w_0() - .hover(|style| style.bg(palette.hover)) - .when(first && spaced && !selecting, |this| this.mt(px(space::LG))) - .when(highlighted, |this| this.bg(palette.tokens.press())) - .when(mentioned, |this| { - this.border_l_2().border_color(palette.accent) - }) - .when(first, |this| { - let author = match author { - Some(user) => profile_popover( - format!("author_{}", message.id), - Anchor::LeftCenter, - user, - entity, - name.cursor_pointer(), - ) - .into_any_element(), - None => name.into_any_element(), - }; - - this.child( - div() - .relative() - .flex() - .items_center() - .gap(px(space::SM)) - .mb(px(space::XXS)) - .child(thread_dot(if selecting { selected } else { mine }, palette)) - .child(author) - .child( - div() - .text_size(text(text::CAPTION)) - .text_color(palette.muted) - .child(millis_time(message.created_at, CLOCK)), - ), + let row = div() + .id(format!("message_row_{}", message.id)) + .group(group.clone()) + .relative() + .flex() + .flex_col() + .min_w_0() + .hover(|style| style.bg(palette.hover)) + .when(first && spaced && !selecting, |this| this.mt(px(space::LG))) + .when(highlighted, |this| this.bg(palette.tokens.press())) + .when(mentioned, |this| { + this.border_l_2().border_color(palette.accent) + }) + .when(first, |this| { + let author = match author { + Some(user) => profile_popover( + format!("author_{}", message.id), + Anchor::LeftCenter, + user, + entity, + name.cursor_pointer(), ) - }) - .child( + .into_any_element(), + None => name.into_any_element(), + }; + + this.child( div() .relative() - .min_w_0() .flex() .items_center() .gap(px(space::SM)) - .when(selecting && !first, |this| { - this.child(thread_dot(selected, palette)) - }) + .mb(px(space::XXS)) + .child(thread_dot(if selecting { selected } else { mine }, palette)) + .child(author) .child( div() - .min_w_0() - .max_w(px(size::PAGE)) - .when(message.body.contains("```"), |this| this.w_full()) - .flex() - .flex_col() - .gap(px(space::SM)) - .children(message_actions::quote_line(message, chat, palette)) - .when(!message.body.is_empty(), |this| { - this.child( - div() - .min_w_0() - .when(message.body.contains("```"), |this| this.w_full()) - .flex() - .flex_wrap() - .items_baseline() - .gap(px(space::XS)) - .text_size(text(text::BODY)) - .line_height(relative(1.55)) - .text_color(palette.body) - .child( + .text_size(text(text::CAPTION)) + .text_color(palette.muted) + .child(millis_time(message.created_at, CLOCK)), + ), + ) + }) + .child( + div() + .relative() + .min_w_0() + .flex() + .items_center() + .gap(px(space::SM)) + .when(selecting && !first, |this| { + this.child(thread_dot(selected, palette)) + }) + .child( + div() + .min_w_0() + .max_w(px(size::PAGE)) + .when(message.body.contains("```"), |this| this.w_full()) + .flex() + .flex_col() + .gap(px(space::SM)) + .children(message_actions::quote_line(message, chat, palette)) + .when(!message.body.is_empty(), |this| { + this.child( + div() + .min_w_0() + .when(message.body.contains("```"), |this| this.w_full()) + .flex() + .flex_wrap() + .items_baseline() + .gap(px(space::XS)) + .text_size(text(text::BODY)) + .line_height(relative(1.55)) + .text_color(palette.body) + .child( + div() + .min_w_0() + .when(message.body.contains("```"), |this| { + this.w_full() + }) + .child( + TextView::markdown( + format!("message-body-{}", message.id), + crate::emoji::markdown(&hard_breaks( + &message.body, + )), + ) + .markdown_extensions(super::glyph::extensions()) + .selectable(true), + ), + ) + .when(message.edited, |this| { + this.child( div() - .min_w_0() - .when(message.body.contains("```"), |this| { - this.w_full() - }) - .child( - TextView::markdown( - format!("message-body-{}", message.id), - crate::emoji::markdown(&hard_breaks( - &message.body, - )), - ) - .markdown_extensions(super::glyph::extensions()) - .selectable(true), - ), + .text_size(text(text::CAPTION)) + .text_color(palette.muted) + .child(w().chat.edited), ) - .when(message.edited, |this| { - this.child( - div() - .text_size(text(text::CAPTION)) - .text_color(palette.muted) - .child(w().chat.edited), - ) - }), - ) - }) - .children(media_view::attachments( - &message.attachments, - &chat.media, + }), + ) + }) + .children(media_view::attachments( + &message.attachments, + &chat.media, + entity, + palette, + )) + .children(snippet::snippet_card(message, chat, entity, palette)) + .children(message.poll.as_ref().map(|poll| { + poll::poll_card( + poll, + poll::PollMode::Live(message), + me, + chat, entity, palette, - )) - .children(snippet::snippet_card(message, chat, entity, palette)) - .children(message.poll.as_ref().map(|poll| { - poll::poll_card( - poll, - poll::PollMode::Live(message), - me, - chat, - entity, - palette, - ) - })) - .children(media_view::embeds(message, &chat.media, palette)) - .children( - (!message.reactions.is_empty()).then(|| { - message_actions::reactions(message, me, entity, palette) - }), - ), - ) - .children(message.pinned.then(|| message_actions::pin_mark(palette))) - .children((!selecting).then(|| { - div().absolute().right_0().top(px(-space::LG)).child( - message_actions::actions(message, chat, me, entity, palette, group), - ) - })), - ) - .children( - (chat.report == Some(ReportTarget::Message(message.id))) - .then(|| message_actions::report_bar(&chat.report_reason, entity, palette)), - ); + ) + })) + .children(media_view::embeds(message, &chat.media, palette)) + .children( + (!message.reactions.is_empty()) + .then(|| message_actions::reactions(message, me, entity, palette)), + ), + ) + .children(message.pinned.then(|| message_actions::pin_mark(palette))) + .children((!selecting).then(|| { + div() + .absolute() + .right_0() + .top_0() + .child(message_actions::actions( + message, chat, me, entity, palette, group, + )) + })), + ) + .children( + (chat.report == Some(ReportTarget::Message(message.id))) + .then(|| message_actions::report_bar(&chat.report_reason, entity, palette)), + ); if !selecting { return row.into_any_element();