agent: Improve provider section spacing in settings view (#33850)

Some design polish here as a follow-up to making the provider accordion
header entirely clickable.

Release Notes:

- agent: Improved design in the provider section by refining spacing.
This commit is contained in:
Danilo Leal 2025-07-03 10:42:15 -03:00 committed by GitHub
parent f34a7abf17
commit 42aca4189a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,8 +26,8 @@ use project::{
}; };
use settings::{Settings, update_settings_file}; use settings::{Settings, update_settings_file};
use ui::{ use ui::{
ContextMenu, Disclosure, ElevationIndex, Indicator, PopoverMenu, Scrollbar, ScrollbarState, ContextMenu, Disclosure, Divider, DividerColor, ElevationIndex, Indicator, PopoverMenu,
Switch, SwitchColor, Tooltip, prelude::*, Scrollbar, ScrollbarState, Switch, SwitchColor, Tooltip, prelude::*,
}; };
use util::ResultExt as _; use util::ResultExt as _;
use workspace::Workspace; use workspace::Workspace;
@ -172,19 +172,29 @@ impl AgentConfiguration {
.unwrap_or(false); .unwrap_or(false);
v_flex() v_flex()
.py_2() .when(is_expanded, |this| this.mb_2())
.gap_1p5() .child(
.border_t_1() div()
.border_color(cx.theme().colors().border.opacity(0.6)) .opacity(0.6)
.px_2()
.child(Divider::horizontal().color(DividerColor::Border)),
)
.child( .child(
h_flex() h_flex()
.map(|this| {
if is_expanded {
this.mt_2().mb_1()
} else {
this.my_2()
}
})
.w_full() .w_full()
.gap_1()
.justify_between() .justify_between()
.child( .child(
h_flex() h_flex()
.id(provider_id_string.clone()) .id(provider_id_string.clone())
.cursor_pointer() .cursor_pointer()
.px_2()
.py_0p5() .py_0p5()
.w_full() .w_full()
.justify_between() .justify_between()
@ -247,12 +257,16 @@ impl AgentConfiguration {
) )
}), }),
) )
.when(is_expanded, |parent| match configuration_view { .child(
Some(configuration_view) => parent.child(configuration_view), div()
None => parent.child(Label::new(format!( .px_2()
"No configuration view for {provider_name}", .when(is_expanded, |parent| match configuration_view {
))), Some(configuration_view) => parent.child(configuration_view),
}) None => parent.child(Label::new(format!(
"No configuration view for {provider_name}",
))),
}),
)
} }
fn render_provider_configuration_section( fn render_provider_configuration_section(
@ -262,12 +276,11 @@ impl AgentConfiguration {
let providers = LanguageModelRegistry::read_global(cx).providers(); let providers = LanguageModelRegistry::read_global(cx).providers();
v_flex() v_flex()
.p(DynamicSpacing::Base16.rems(cx))
.pr(DynamicSpacing::Base20.rems(cx))
.border_b_1()
.border_color(cx.theme().colors().border)
.child( .child(
v_flex() v_flex()
.p(DynamicSpacing::Base16.rems(cx))
.pr(DynamicSpacing::Base20.rems(cx))
.pb_0()
.mb_2p5() .mb_2p5()
.gap_0p5() .gap_0p5()
.child(Headline::new("LLM Providers")) .child(Headline::new("LLM Providers"))
@ -276,10 +289,15 @@ impl AgentConfiguration {
.color(Color::Muted), .color(Color::Muted),
), ),
) )
.children( .child(
providers div()
.into_iter() .pl(DynamicSpacing::Base08.rems(cx))
.map(|provider| self.render_provider_configuration_block(&provider, cx)), .pr(DynamicSpacing::Base20.rems(cx))
.children(
providers.into_iter().map(|provider| {
self.render_provider_configuration_block(&provider, cx)
}),
),
) )
} }