From 6bec76cd5d32dcc4723417605c9b7286ad4bfdb9 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Fri, 16 May 2025 10:25:21 -0300 Subject: [PATCH] agent: Allow dismissing previous message by clicking on the backdrop (#30822) Release Notes: - agent: Improved UX for dismissing an edit to a previous message. --- crates/agent/src/active_thread.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index 3b7e8b3ee4a9d8609bcba42afc2653039f76009b..827a3f1fcb6edd9bae23c06e1e31591ee4f18c72 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -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() }