Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent_ui: Add more UI refinements to the sidebar (#51325)
Danilo Leal9d2e2c859b9a
diff --git a/crates/agent_ui/src/agent_configuration.rs b/crates/agent_ui/src/agent_configuration.rsindex aa316ba7c5e..46f92bfb2cf 100644--- a/crates/agent_ui/src/agent_configuration.rs+++ b/crates/agent_ui/src/agent_configuration.rs@@ -228,6 +228,7 @@ impl AgentConfiguration {.unwrap_or(false);v_flex()+ .min_w_0().w_full().when(is_expanded, |this| this.mb_2()).child(@@ -312,6 +313,7 @@ impl AgentConfiguration {).child(v_flex()+ .min_w_0().w_full().px_2().gap_1()@@ -459,6 +461,7 @@ impl AgentConfiguration {});v_flex()+ .min_w_0().w_full().child(self.render_section_title("LLM Providers",@@ -559,6 +562,7 @@ impl AgentConfiguration {});v_flex()+ .min_w_0().border_b_1().border_color(cx.theme().colors().border).child(self.render_section_title(@@ -802,9 +806,12 @@ impl AgentConfiguration {});v_flex()+ .min_w_0().id(item_id.clone()).child(h_flex()+ .min_w_0()+ .w_full().justify_between().child(h_flex()@@ -820,13 +827,13 @@ impl AgentConfiguration {.tooltip(Tooltip::text(tooltip_text)).child(status_indicator),)- .child(Label::new(item_id).truncate())+ .child(Label::new(item_id).flex_shrink_0().truncate()).child(div().id("extension-source")+ .min_w_0().mt_0p5().mx_1()- .flex_none().tooltip(Tooltip::text(source_tooltip)).child(Icon::new(source_icon)@@ -1019,6 +1026,7 @@ impl AgentConfiguration {});v_flex()+ .min_w_0().border_b_1().border_color(cx.theme().colors().border).child(@@ -1217,6 +1225,7 @@ impl Render for AgentConfiguration {.id("assistant-configuration-content").track_scroll(&self.scroll_handle).size_full()+ .min_w_0().overflow_y_scroll().child(self.render_agent_servers_section(cx)).child(self.render_context_servers_section(window, cx))diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 50346bd752c..1aefc99c020 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -4131,7 +4131,10 @@ impl AgentPanel {ActiveView::History { .. } | ActiveView::Configuration);- let use_v2_empty_toolbar = has_v2_flag && is_empty_state && !is_in_history_or_config;+ let is_text_thread = matches!(&self.active_view, ActiveView::TextThread { .. });++ let use_v2_empty_toolbar =+ has_v2_flag && is_empty_state && !is_in_history_or_config && !is_text_thread;let is_sidebar_open = self.sidebardiff --git a/crates/agent_ui/src/sidebar.rs b/crates/agent_ui/src/sidebar.rsindex e36cb750b4a..595366dd048 100644--- a/crates/agent_ui/src/sidebar.rs+++ b/crates/agent_ui/src/sidebar.rs@@ -1250,7 +1250,7 @@ impl Sidebar {.focused(is_selected).child(h_flex()- .p_1()+ .py_1().gap_1p5().child(Icon::new(icon).size(IconSize::Small).color(Color::Muted)).child(Label::new(label).color(Color::Muted))diff --git a/crates/ui/src/components/chip.rs b/crates/ui/src/components/chip.rsindex ce709fe3962..06dc7e6afa6 100644--- a/crates/ui/src/components/chip.rs+++ b/crates/ui/src/components/chip.rs@@ -81,8 +81,7 @@ impl RenderOnce for Chip {h_flex().when_some(self.height, |this, h| this.h(h))- .min_w_0()- .flex_initial()+ .flex_none().px_1().border_1().rounded_sm()diff --git a/crates/ui/src/components/label/label.rs b/crates/ui/src/components/label/label.rsindex d0f50c00336..405948ea06c 100644--- a/crates/ui/src/components/label/label.rs+++ b/crates/ui/src/components/label/label.rs@@ -73,6 +73,34 @@ impl Label {gpui::margin_style_methods!({visibility: pub});++ pub fn flex_1(mut self) -> Self {+ self.style().flex_grow = Some(1.);+ self.style().flex_shrink = Some(1.);+ self.style().flex_basis = Some(gpui::relative(0.).into());+ self+ }++ pub fn flex_none(mut self) -> Self {+ self.style().flex_grow = Some(0.);+ self.style().flex_shrink = Some(0.);+ self+ }++ pub fn flex_grow(mut self) -> Self {+ self.style().flex_grow = Some(1.);+ self+ }++ pub fn flex_shrink(mut self) -> Self {+ self.style().flex_shrink = Some(1.);+ self+ }++ pub fn flex_shrink_0(mut self) -> Self {+ self.style().flex_shrink = Some(0.);+ self+ }}impl LabelCommon for Label {