From b8eea31a09b4b8cc68ef4dbb68dae72b9d105bc1 Mon Sep 17 00:00:00 2001 From: Cameron Mcloughlin Date: Fri, 13 Mar 2026 03:56:25 +0000 Subject: [PATCH] agent: Add tooltip to diff stats (#51448) --- crates/ui/src/components/ai/thread_item.rs | 14 ++++++++------ crates/ui/src/components/diff_stat.rs | 12 ++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/crates/ui/src/components/ai/thread_item.rs b/crates/ui/src/components/ai/thread_item.rs index 13e1db8f483ea251a6f65b61054c205d040a0d53..35aa3487a39c69795545b646666840743cfd8526 100644 --- a/crates/ui/src/components/ai/thread_item.rs +++ b/crates/ui/src/components/ai/thread_item.rs @@ -311,11 +311,10 @@ impl RenderOnce for ThreadItem { this.child(dot_separator()) }) .when(has_diff_stats, |this| { - this.child(DiffStat::new( - diff_stat_id.clone(), - added_count, - removed_count, - )) + this.child( + DiffStat::new(diff_stat_id.clone(), added_count, removed_count) + .tooltip("Unreviewed changes"), + ) }) .when(has_diff_stats && has_timestamp, |this| { this.child(dot_separator()) @@ -336,7 +335,10 @@ impl RenderOnce for ThreadItem { .gap_1p5() .child(icon_container()) // Icon Spacing .when(has_diff_stats, |this| { - this.child(DiffStat::new(diff_stat_id, added_count, removed_count)) + this.child( + DiffStat::new(diff_stat_id, added_count, removed_count) + .tooltip("Unreviewed changes"), + ) }) .when(has_diff_stats && has_timestamp, |this| { this.child(dot_separator()) diff --git a/crates/ui/src/components/diff_stat.rs b/crates/ui/src/components/diff_stat.rs index 45539c62869b8c23cb76671d2a7a862c9592a181..c2e76b171e7e28cc5cb2e2b0c4d776b5bc7e2bfc 100644 --- a/crates/ui/src/components/diff_stat.rs +++ b/crates/ui/src/components/diff_stat.rs @@ -1,3 +1,4 @@ +use crate::Tooltip; use crate::prelude::*; #[derive(IntoElement, RegisterComponent)] @@ -6,6 +7,7 @@ pub struct DiffStat { added: usize, removed: usize, label_size: LabelSize, + tooltip: Option, } impl DiffStat { @@ -15,6 +17,7 @@ impl DiffStat { added, removed, label_size: LabelSize::Small, + tooltip: None, } } @@ -22,10 +25,16 @@ impl DiffStat { self.label_size = label_size; self } + + pub fn tooltip(mut self, tooltip: impl Into) -> Self { + self.tooltip = Some(tooltip.into()); + self + } } impl RenderOnce for DiffStat { fn render(self, _: &mut Window, _cx: &mut App) -> impl IntoElement { + let tooltip = self.tooltip; h_flex() .id(self.id) .gap_1() @@ -39,6 +48,9 @@ impl RenderOnce for DiffStat { .color(Color::Error) .size(self.label_size), ) + .when_some(tooltip, |this, tooltip| { + this.tooltip(Tooltip::text(tooltip)) + }) } }