forge
Explore
Log in

Don't you dare go Hollow

Message actions bar sat above the message, outside its hover area, so reaching for it hid it

Browse files at this commit

953edffac08f9190cac3ca2523a7fef48f42bf3fAhmet Kaan GümüşParent: 4c33576
  • fix
    • message actions bar sat above the message, outside its hover area, so reaching for it hid it
    • it now overlaps the message's own top edge
Show full message
🐛 fix: message actions bar sat above the message, outside its hover area, so reaching for it hid it; it now overlaps the message's own top edge
crates/client/src/gui/chat.rsmodified+127 -125
@@ -3536,143 +3536,145 @@ fn render_message(
3536 .as_ref()3536 .as_ref()
3537 .is_some_and(|(id, at)| id == &message.id && at.elapsed() < HIGHLIGHT_TTL);3537 .is_some_and(|(id, at)| id == &message.id && at.elapsed() < HIGHLIGHT_TTL);
3538 3538
3539- let row =3539+ let row = div()
3540- div()3540+ .id(format!("message_row_{}", message.id))
3541- .id(format!("message_row_{}", message.id))3541+ .group(group.clone())
3542- .group(group.clone())3542+ .relative()
3543- .relative()3543+ .flex()
3544- .flex()3544+ .flex_col()
3545- .flex_col()3545+ .min_w_0()
3546- .min_w_0()3546+ .hover(|style| style.bg(palette.hover))
3547- .hover(|style| style.bg(palette.hover))3547+ .when(first && spaced && !selecting, |this| this.mt(px(space::LG)))
3548- .when(first && spaced && !selecting, |this| this.mt(px(space::LG)))3548+ .when(highlighted, |this| this.bg(palette.tokens.press()))
3549- .when(highlighted, |this| this.bg(palette.tokens.press()))3549+ .when(mentioned, |this| {
3550- .when(mentioned, |this| {3550+ this.border_l_2().border_color(palette.accent)
3551- this.border_l_2().border_color(palette.accent)3551+ })
3552- })3552+ .when(first, |this| {
3553- .when(first, |this| {3553+ let author = match author {
3554- let author = match author {3554+ Some(user) => profile_popover(
3555- Some(user) => profile_popover(3555+ format!("author_{}", message.id),
3556- format!("author_{}", message.id),3556+ Anchor::LeftCenter,
3557- Anchor::LeftCenter,3557+ user,
3558- user,3558+ entity,
3559- entity,3559+ name.cursor_pointer(),
3560- name.cursor_pointer(),
3561- )
3562- .into_any_element(),
3563- None => name.into_any_element(),
3564- };
3565-
3566- this.child(
3567- div()
3568- .relative()
3569- .flex()
3570- .items_center()
3571- .gap(px(space::SM))
3572- .mb(px(space::XXS))
3573- .child(thread_dot(if selecting { selected } else { mine }, palette))
3574- .child(author)
3575- .child(
3576- div()
3577- .text_size(text(text::CAPTION))
3578- .text_color(palette.muted)
3579- .child(millis_time(message.created_at, CLOCK)),
3580- ),
3581 )3560 )
3582- })3561+ .into_any_element(),
3583- .child(3562+ None => name.into_any_element(),
3563+ };
3564+
3565+ this.child(
3584 div()3566 div()
3585 .relative()3567 .relative()
3586- .min_w_0()
3587 .flex()3568 .flex()
3588 .items_center()3569 .items_center()
3589 .gap(px(space::SM))3570 .gap(px(space::SM))
3590- .when(selecting && !first, |this| {3571+ .mb(px(space::XXS))
3591- this.child(thread_dot(selected, palette))3572+ .child(thread_dot(if selecting { selected } else { mine }, palette))
3592- })3573+ .child(author)
3593 .child(3574 .child(
3594 div()3575 div()
3595- .min_w_0()3576+ .text_size(text(text::CAPTION))
3596- .max_w(px(size::PAGE))3577+ .text_color(palette.muted)
3597- .when(message.body.contains("```"), |this| this.w_full())3578+ .child(millis_time(message.created_at, CLOCK)),
3598- .flex()3579+ ),
3599- .flex_col()3580+ )
3600- .gap(px(space::SM))3581+ })
3601- .children(message_actions::quote_line(message, chat, palette))3582+ .child(
3602- .when(!message.body.is_empty(), |this| {3583+ div()
3603- this.child(3584+ .relative()
3604- div()3585+ .min_w_0()
3605- .min_w_0()3586+ .flex()
3606- .when(message.body.contains("```"), |this| this.w_full())3587+ .items_center()
3607- .flex()3588+ .gap(px(space::SM))
3608- .flex_wrap()3589+ .when(selecting && !first, |this| {
3609- .items_baseline()3590+ this.child(thread_dot(selected, palette))
3610- .gap(px(space::XS))3591+ })
3611- .text_size(text(text::BODY))3592+ .child(
3612- .line_height(relative(1.55))3593+ div()
3613- .text_color(palette.body)3594+ .min_w_0()
3614- .child(3595+ .max_w(px(size::PAGE))
3596+ .when(message.body.contains("```"), |this| this.w_full())
3597+ .flex()
3598+ .flex_col()
3599+ .gap(px(space::SM))
3600+ .children(message_actions::quote_line(message, chat, palette))
3601+ .when(!message.body.is_empty(), |this| {
3602+ this.child(
3603+ div()
3604+ .min_w_0()
3605+ .when(message.body.contains("```"), |this| this.w_full())
3606+ .flex()
3607+ .flex_wrap()
3608+ .items_baseline()
3609+ .gap(px(space::XS))
3610+ .text_size(text(text::BODY))
3611+ .line_height(relative(1.55))
3612+ .text_color(palette.body)
3613+ .child(
3614+ div()
3615+ .min_w_0()
3616+ .when(message.body.contains("```"), |this| {
3617+ this.w_full()
3618+ })
3619+ .child(
3620+ TextView::markdown(
3621+ format!("message-body-{}", message.id),
3622+ crate::emoji::markdown(&hard_breaks(
3623+ &message.body,
3624+ )),
3625+ )
3626+ .markdown_extensions(super::glyph::extensions())
3627+ .selectable(true),
3628+ ),
3629+ )
3630+ .when(message.edited, |this| {
3631+ this.child(
3615 div()3632 div()
3616- .min_w_0()3633+ .text_size(text(text::CAPTION))
3617- .when(message.body.contains("```"), |this| {3634+ .text_color(palette.muted)
3618- this.w_full()3635+ .child(w().chat.edited),
3619- })
3620- .child(
3621- TextView::markdown(
3622- format!("message-body-{}", message.id),
3623- crate::emoji::markdown(&hard_breaks(
3624- &message.body,
3625- )),
3626- )
3627- .markdown_extensions(super::glyph::extensions())
3628- .selectable(true),
3629- ),
3630 )3636 )
3631- .when(message.edited, |this| {3637+ }),
3632- this.child(3638+ )
3633- div()3639+ })
3634- .text_size(text(text::CAPTION))3640+ .children(media_view::attachments(
3635- .text_color(palette.muted)3641+ &message.attachments,
3636- .child(w().chat.edited),3642+ &chat.media,
3637- )3643+ entity,
3638- }),3644+ palette,
3639- )3645+ ))
3640- })3646+ .children(snippet::snippet_card(message, chat, entity, palette))
3641- .children(media_view::attachments(3647+ .children(message.poll.as_ref().map(|poll| {
3642- &message.attachments,3648+ poll::poll_card(
3643- &chat.media,3649+ poll,
3650+ poll::PollMode::Live(message),
3651+ me,
3652+ chat,
3644 entity,3653 entity,
3645 palette,3654 palette,
3646- ))3655+ )
3647- .children(snippet::snippet_card(message, chat, entity, palette))3656+ }))
3648- .children(message.poll.as_ref().map(|poll| {3657+ .children(media_view::embeds(message, &chat.media, palette))
3649- poll::poll_card(3658+ .children(
3650- poll,3659+ (!message.reactions.is_empty())
3651- poll::PollMode::Live(message),3660+ .then(|| message_actions::reactions(message, me, entity, palette)),
3652- me,3661+ ),
3653- chat,3662+ )
3654- entity,3663+ .children(message.pinned.then(|| message_actions::pin_mark(palette)))
3655- palette,3664+ .children((!selecting).then(|| {
3656- )3665+ div()
3657- }))3666+ .absolute()
3658- .children(media_view::embeds(message, &chat.media, palette))3667+ .right_0()
3659- .children(3668+ .top_0()
3660- (!message.reactions.is_empty()).then(|| {3669+ .child(message_actions::actions(
3661- message_actions::reactions(message, me, entity, palette)3670+ message, chat, me, entity, palette, group,
3662- }),3671+ ))
3663- ),3672+ })),
3664- )3673+ )
3665- .children(message.pinned.then(|| message_actions::pin_mark(palette)))3674+ .children(
3666- .children((!selecting).then(|| {3675+ (chat.report == Some(ReportTarget::Message(message.id)))
3667- div().absolute().right_0().top(px(-space::LG)).child(3676+ .then(|| message_actions::report_bar(&chat.report_reason, entity, palette)),
3668- message_actions::actions(message, chat, me, entity, palette, group),3677+ );
3669- )
3670- })),
3671- )
3672- .children(
3673- (chat.report == Some(ReportTarget::Message(message.id)))
3674- .then(|| message_actions::report_bar(&chat.report_reason, entity, palette)),
3675- );
3676 3678
3677 if !selecting {3679 if !selecting {
3678 return row.into_any_element();3680 return row.into_any_element();