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