Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
sidebar: Add small refinements to the header design (#58661)
Danilo Lealdde98fa822c5
diff --git a/crates/recent_projects/src/sidebar_recent_projects.rs b/crates/recent_projects/src/sidebar_recent_projects.rsindex 21de23a1ce8..a8726024e84 100644--- a/crates/recent_projects/src/sidebar_recent_projects.rs+++ b/crates/recent_projects/src/sidebar_recent_projects.rs@@ -135,7 +135,7 @@ impl PickerDelegate for SidebarRecentProjectsDelegate {type ListItem = AnyElement;fn placeholder_text(&self, _window: &mut Window, _cx: &mut App) -> Arc<str> {- "Search recent projects…".into()+ "Search projects…".into()}fn render_editor(@@ -410,7 +410,7 @@ impl PickerDelegate for SidebarRecentProjectsDelegate {.w_full().gap_1().justify_between()- .child(Label::new("Add Local Folders"))+ .child(Label::new("Open Local Folders")).child(KeyBinding::for_action_in(&open_action, &focus_handle, cx)),).on_click(cx.listener(move |_, _, window, cx| {@@ -425,7 +425,7 @@ impl PickerDelegate for SidebarRecentProjectsDelegate {.w_full().gap_1().justify_between()- .child(Label::new("Add Remote Folder"))+ .child(Label::new("Open Remote Folder")).child(KeyBinding::for_action(&OpenRemote {from_existing_connection: false,diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rsindex 0d94636c985..1697273ad12 100644--- a/crates/sidebar/src/sidebar.rs+++ b/crates/sidebar/src/sidebar.rs@@ -2171,18 +2171,6 @@ impl Sidebar {is_active: is_active_group,has_threads,} => {- let has_active_draft = is_active- && self- .active_workspace(cx)- .and_then(|ws| ws.read(cx).panel::<AgentPanel>(cx))- .is_some_and(|panel| {- let panel = panel.read(cx);- // An active terminal is its own surface, not a draft.- panel.active_terminal_id().is_none()- && (panel.active_view_is_new_draft(cx)- || panel.active_conversation_view().is_none())- });-self.project_header_menu_handles.entry(ix).or_default();self.project_header_new_thread_menu_handles.entry(ix)@@ -2200,7 +2188,7 @@ impl Sidebar {*is_active_group,is_selected,*has_threads,- has_active_draft,+ // has_active_draft,cx,)}@@ -2259,7 +2247,6 @@ impl Sidebar {is_active: bool,is_focused: bool,has_threads: bool,- has_active_draft: bool,cx: &mut Context<Self>,) -> AnyElement {let host = key.host();@@ -2391,18 +2378,10 @@ impl Sidebar {.child(gradient_overlay()).child(h_flex()+ .gap_px()+ .pr_1p5().child(gradient_overlay())- .on_mouse_down(gpui::MouseButton::Left, |_, _, cx| {- cx.stop_propagation();- })- .child(self.render_new_thread_button(- ix,- id_prefix,- key,- has_active_draft,- &group_name,- cx,- ))+ .child(self.render_new_thread_button(ix, id_prefix, key, &group_name, cx)).child(self.render_project_header_ellipsis_menu(ix,id_prefix,@@ -2411,7 +2390,10 @@ impl Sidebar {has_threads,&group_name,cx,- )),+ ))+ .on_mouse_down(gpui::MouseButton::Left, |_, _, cx| {+ cx.stop_propagation();+ }),).on_mouse_down(gpui::MouseButton::Right, {let menu_handle = self@@ -2432,7 +2414,8 @@ impl Sidebar {this.toggle_collapse(&key_for_toggle, window, cx);}}),- );+ )+ .occlude();if !is_collapsed && !has_threads {v_flex()@@ -2464,7 +2447,6 @@ impl Sidebar {ix: usize,id_prefix: &str,key: &ProjectGroupKey,- has_active_draft: bool,group_name: &SharedString,cx: &mut Context<Self>,) -> AnyElement {@@ -2483,10 +2465,7 @@ impl Sidebar {).selected_style(ButtonStyle::Tinted(TintColor::Accent)).icon_size(IconSize::Small)- .when(has_active_draft, |this| this.icon_color(Color::Accent))- .when(!has_active_draft && !is_menu_open, |this| {- this.visible_on_hover(group_name)- });+ .when(!is_menu_open, |this| this.visible_on_hover(group_name));let open_workspaces = self.multi_workspace@@ -2610,6 +2589,11 @@ impl Sidebar {},))})+ .anchor(gpui::Anchor::TopRight)+ .offset(gpui::Point {+ x: px(0.),+ y: px(1.),+ }).into_any_element()}@@ -3020,17 +3004,6 @@ impl Sidebar {let is_focused = self.focus_handle.is_focused(window);let is_selected = is_focused && self.selection == Some(header_idx);- let has_active_draft = *is_active- && self- .active_workspace(cx)- .and_then(|ws| ws.read(cx).panel::<AgentPanel>(cx))- .is_some_and(|panel| {- let panel = panel.read(cx);- // An active terminal is its own surface, not a draft.- panel.active_terminal_id().is_none()- && (panel.active_view_is_new_draft(cx)- || panel.active_conversation_view().is_none())- });let header_element = self.render_project_header(header_idx,true,@@ -3043,7 +3016,6 @@ impl Sidebar {*is_active,is_selected,*has_threads,- has_active_draft,cx,);@@ -3075,7 +3047,7 @@ impl Sidebar {.border_b_1().border_color(color.border.opacity(0.5)).child(header_element)- .shadow_xs()+ .shadow_sm().into_any_element();Some(element)@@ -6190,7 +6162,6 @@ impl Sidebar {.when(is_hovered && !is_renaming, |this| {let rename_button = IconButton::new(("rename-thread", ix), IconName::Pencil).icon_size(IconSize::Small)- .icon_color(Color::Muted).tooltip({let focus_handle = focus_handle.clone();move |_window, cx| {@@ -6233,7 +6204,6 @@ impl Sidebar {Some(DraftKind::WithContent) => Some(IconButton::new("discard_thread", IconName::Close).icon_size(IconSize::Small)- .icon_color(Color::Muted).tooltip(Tooltip::text("Discard Draft")).on_click({let thread_workspace = thread_workspace.clone();@@ -6251,7 +6221,6 @@ impl Sidebar {None => Some(IconButton::new("archive-thread", IconName::Archive).icon_size(IconSize::Small)- .icon_color(Color::Muted).tooltip({let focus_handle = focus_handle.clone();move |_window, cx| {diff --git a/crates/ui/src/components/ai/thread_item.rs b/crates/ui/src/components/ai/thread_item.rsindex bb248ee481f..64dd8d1e090 100644--- a/crates/ui/src/components/ai/thread_item.rs+++ b/crates/ui/src/components/ai/thread_item.rs@@ -453,20 +453,20 @@ impl RenderOnce for ThreadItem {.when(self.hovered, |this| {this.when_some(self.action_slot, |this, slot| {let overlay = GradientFade::new(base_bg, hover_bg, hover_bg)- .width(px(80.0))+ .width(px(120.0)).right(px(8.))- .gradient_stop(0.80)+ .gradient_stop(0.90).group_name("thread-item");this.child(h_flex().relative().pr_1p5()+ .child(overlay)+ .child(slot).on_mouse_down(MouseButton::Left, |_, _, cx| {cx.stop_propagation()- })- .child(overlay)- .child(slot),+ }),)})}),@@ -482,7 +482,6 @@ impl RenderOnce for ThreadItem {Color::Custom(cx.theme().colors().icon_muted.opacity(0.5)),),)- // .child(dot_separator())}).when(has_project_name || has_project_paths || has_worktree,