agent: Allow dismissing previous message by clicking on the backdrop (#30822)

Release Notes:

- agent: Improved UX for dismissing an edit to a previous message.
This commit is contained in:
Danilo Leal 2025-05-16 10:25:21 -03:00 committed by GitHub
parent d4f47aa653
commit 6bec76cd5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2028,9 +2028,6 @@ impl ActiveThread {
)
}),
)
.when(editing_message_state.is_none(), |this| {
this.tooltip(Tooltip::text("Click To Edit"))
})
.on_click(cx.listener({
let message_segments = message.segments.clone();
move |this, _, window, cx| {
@ -2071,6 +2068,16 @@ impl ActiveThread {
let panel_background = cx.theme().colors().panel_background;
let backdrop = div()
.id("backdrop")
.stop_mouse_events_except_scroll()
.absolute()
.inset_0()
.size_full()
.bg(panel_background)
.opacity(0.8)
.on_click(cx.listener(Self::handle_cancel_click));
v_flex()
.w_full()
.map(|parent| {
@ -2240,15 +2247,7 @@ impl ActiveThread {
})
.when(after_editing_message, |parent| {
// Backdrop to dim out the whole thread below the editing user message
parent.relative().child(
div()
.stop_mouse_events_except_scroll()
.absolute()
.inset_0()
.size_full()
.bg(panel_background)
.opacity(0.8),
)
parent.relative().child(backdrop)
})
.into_any()
}