mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
agent_ui: Restrict agent toolbar width only for threads (#56410)
For all other modes, we want full-width view Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A
This commit is contained in:
parent
0efac164b3
commit
cb715fb374
1 changed files with 21 additions and 10 deletions
|
|
@ -3775,10 +3775,22 @@ impl AgentPanel {
|
|||
selected_agent.into_any_element()
|
||||
};
|
||||
|
||||
let is_empty_state = !matches!(self.base_view, BaseView::Terminal { .. })
|
||||
&& !self.active_thread_has_messages(cx);
|
||||
enum ToolbarMode {
|
||||
Overlay,
|
||||
Terminal,
|
||||
EmptyThread,
|
||||
ActiveThread,
|
||||
}
|
||||
|
||||
let is_in_history_or_config = self.is_overlay_open();
|
||||
let mode = if self.is_overlay_open() {
|
||||
ToolbarMode::Overlay
|
||||
} else if matches!(self.base_view, BaseView::Terminal { .. }) {
|
||||
ToolbarMode::Terminal
|
||||
} else if self.active_thread_has_messages(cx) {
|
||||
ToolbarMode::ActiveThread
|
||||
} else {
|
||||
ToolbarMode::EmptyThread
|
||||
};
|
||||
|
||||
let is_full_screen = self.is_zoomed(window, cx);
|
||||
let full_screen_button = if is_full_screen {
|
||||
|
|
@ -3797,20 +3809,19 @@ impl AgentPanel {
|
|||
}))
|
||||
};
|
||||
|
||||
let use_v2_empty_toolbar = is_empty_state && !is_in_history_or_config;
|
||||
|
||||
let max_content_width = AgentSettings::get_global(cx).max_content_width;
|
||||
|
||||
let base_container = h_flex()
|
||||
.size_full()
|
||||
.when(!is_in_history_or_config, |this| {
|
||||
this.when_some(max_content_width, |this, max_w| this.max_w(max_w).mx_auto())
|
||||
})
|
||||
.when(
|
||||
matches!(mode, ToolbarMode::EmptyThread | ToolbarMode::ActiveThread),
|
||||
|this| this.when_some(max_content_width, |this, max_w| this.max_w(max_w).mx_auto()),
|
||||
)
|
||||
.flex_none()
|
||||
.justify_between()
|
||||
.gap_2();
|
||||
|
||||
let toolbar_content = if use_v2_empty_toolbar {
|
||||
let toolbar_content = if matches!(mode, ToolbarMode::EmptyThread) {
|
||||
let (chevron_icon, icon_color, label_color) =
|
||||
if self.new_thread_menu_handle.is_deployed() {
|
||||
(IconName::ChevronUp, Color::Accent, Color::Accent)
|
||||
|
|
@ -3903,7 +3914,7 @@ impl AgentPanel {
|
|||
.size_full()
|
||||
.gap(DynamicSpacing::Base04.rems(cx))
|
||||
.pl(DynamicSpacing::Base04.rems(cx))
|
||||
.child(if self.is_overlay_open() {
|
||||
.child(if matches!(mode, ToolbarMode::Overlay) {
|
||||
self.render_toolbar_back_button(cx).into_any_element()
|
||||
} else {
|
||||
selected_agent.into_any_element()
|
||||
|
|
|
|||
Loading…
Reference in a new issue