agent2: Experiment with new toolbar design (#36366)

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-08-17 13:39:14 -03:00 committed by GitHub
parent faaaf02bf2
commit 9cd13a35de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 35 deletions

View file

@ -65,8 +65,8 @@ use theme::ThemeSettings;
use time::UtcOffset; use time::UtcOffset;
use ui::utils::WithRemSize; use ui::utils::WithRemSize;
use ui::{ use ui::{
Banner, Callout, ContextMenu, ContextMenuEntry, ElevationIndex, KeyBinding, PopoverMenu, Banner, Callout, ContextMenu, ContextMenuEntry, Divider, ElevationIndex, KeyBinding,
PopoverMenuHandle, ProgressBar, Tab, Tooltip, prelude::*, PopoverMenu, PopoverMenuHandle, ProgressBar, Tab, Tooltip, prelude::*,
}; };
use util::ResultExt as _; use util::ResultExt as _;
use workspace::{ use workspace::{
@ -243,9 +243,9 @@ pub enum AgentType {
impl AgentType { impl AgentType {
fn label(self) -> impl Into<SharedString> { fn label(self) -> impl Into<SharedString> {
match self { match self {
Self::Zed | Self::TextThread => "Zed", Self::Zed | Self::TextThread => "Zed Agent",
Self::NativeAgent => "Agent 2", Self::NativeAgent => "Agent 2",
Self::Gemini => "Gemini", Self::Gemini => "Google Gemini",
Self::ClaudeCode => "Claude Code", Self::ClaudeCode => "Claude Code",
} }
} }
@ -1784,7 +1784,8 @@ impl AgentPanel {
.w_full() .w_full()
.child(change_title_editor.clone()) .child(change_title_editor.clone())
.child( .child(
ui::IconButton::new("retry-summary-generation", IconName::RotateCcw) IconButton::new("retry-summary-generation", IconName::RotateCcw)
.icon_size(IconSize::Small)
.on_click({ .on_click({
let active_thread = active_thread.clone(); let active_thread = active_thread.clone();
move |_, _window, cx| { move |_, _window, cx| {
@ -1836,7 +1837,8 @@ impl AgentPanel {
.w_full() .w_full()
.child(title_editor.clone()) .child(title_editor.clone())
.child( .child(
ui::IconButton::new("retry-summary-generation", IconName::RotateCcw) IconButton::new("retry-summary-generation", IconName::RotateCcw)
.icon_size(IconSize::Small)
.on_click({ .on_click({
let context_editor = context_editor.clone(); let context_editor = context_editor.clone();
move |_, _window, cx| { move |_, _window, cx| {
@ -1974,21 +1976,17 @@ impl AgentPanel {
}) })
} }
fn render_recent_entries_menu( fn render_recent_entries_menu(&self, cx: &mut Context<Self>) -> impl IntoElement {
&self,
icon: IconName,
cx: &mut Context<Self>,
) -> impl IntoElement {
let focus_handle = self.focus_handle(cx); let focus_handle = self.focus_handle(cx);
PopoverMenu::new("agent-nav-menu") PopoverMenu::new("agent-nav-menu")
.trigger_with_tooltip( .trigger_with_tooltip(
IconButton::new("agent-nav-menu", icon).icon_size(IconSize::Small), IconButton::new("agent-nav-menu", IconName::MenuAlt).icon_size(IconSize::Small),
{ {
let focus_handle = focus_handle.clone(); let focus_handle = focus_handle.clone();
move |window, cx| { move |window, cx| {
Tooltip::for_action_in( Tooltip::for_action_in(
"Toggle Panel Menu", "Toggle Recent Threads",
&ToggleNavigationMenu, &ToggleNavigationMenu,
&focus_handle, &focus_handle,
window, window,
@ -2124,9 +2122,7 @@ impl AgentPanel {
.pl(DynamicSpacing::Base04.rems(cx)) .pl(DynamicSpacing::Base04.rems(cx))
.child(self.render_toolbar_back_button(cx)) .child(self.render_toolbar_back_button(cx))
.into_any_element(), .into_any_element(),
_ => self _ => self.render_recent_entries_menu(cx).into_any_element(),
.render_recent_entries_menu(IconName::MenuAlt, cx)
.into_any_element(),
}) })
.child(self.render_title_view(window, cx)), .child(self.render_title_view(window, cx)),
) )
@ -2364,6 +2360,22 @@ impl AgentPanel {
} }
}); });
let selected_agent_label = self.selected_agent.label().into();
let selected_agent = div()
.id("selected_agent_icon")
.px(DynamicSpacing::Base02.rems(cx))
.child(Icon::new(self.selected_agent.icon()).color(Color::Muted))
.tooltip(move |window, cx| {
Tooltip::with_meta(
selected_agent_label.clone(),
None,
"Selected Agent",
window,
cx,
)
})
.into_any_element();
h_flex() h_flex()
.id("agent-panel-toolbar") .id("agent-panel-toolbar")
.h(Tab::container_height(cx)) .h(Tab::container_height(cx))
@ -2377,26 +2389,17 @@ impl AgentPanel {
.child( .child(
h_flex() h_flex()
.size_full() .size_full()
.gap(DynamicSpacing::Base08.rems(cx)) .gap(DynamicSpacing::Base04.rems(cx))
.pl(DynamicSpacing::Base04.rems(cx))
.child(match &self.active_view { .child(match &self.active_view {
ActiveView::History | ActiveView::Configuration => div() ActiveView::History | ActiveView::Configuration => {
.pl(DynamicSpacing::Base04.rems(cx)) self.render_toolbar_back_button(cx).into_any_element()
.child(self.render_toolbar_back_button(cx)) }
.into_any_element(),
_ => h_flex() _ => h_flex()
.h_full() .gap_1()
.px(DynamicSpacing::Base04.rems(cx)) .child(self.render_recent_entries_menu(cx))
.border_r_1() .child(Divider::vertical())
.border_color(cx.theme().colors().border) .child(selected_agent)
.child(
h_flex()
.px_0p5()
.gap_1p5()
.child(
Icon::new(self.selected_agent.icon()).color(Color::Muted),
)
.child(Label::new(self.selected_agent.label())),
)
.into_any_element(), .into_any_element(),
}) })
.child(self.render_title_view(window, cx)), .child(self.render_title_view(window, cx)),
@ -2415,7 +2418,6 @@ impl AgentPanel {
.border_l_1() .border_l_1()
.border_color(cx.theme().colors().border) .border_color(cx.theme().colors().border)
.child(new_thread_menu) .child(new_thread_menu)
.child(self.render_recent_entries_menu(IconName::HistoryRerun, cx))
.child(self.render_panel_options_menu(window, cx)), .child(self.render_panel_options_menu(window, cx)),
), ),
) )

View file

@ -541,6 +541,7 @@ impl Render for ThreadHistory {
v_flex() v_flex()
.key_context("ThreadHistory") .key_context("ThreadHistory")
.size_full() .size_full()
.bg(cx.theme().colors().panel_background)
.on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_previous))
.on_action(cx.listener(Self::select_next)) .on_action(cx.listener(Self::select_next))
.on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_first))