agent: Expand disclosure click area in setting view's provider section (#33041)
Previously, you could only expand the provider item in the agent panel settings view by clicking on the little chevron icon button. Now, you can click on the whole title area (minus the button, when present) to do that. Just that little bit more convenient to interact with it. Release Notes: - N/A
This commit is contained in:
parent
3b31db1b1f
commit
ddaa8b3d02
1 changed files with 65 additions and 55 deletions
|
@ -148,6 +148,8 @@ impl AgentConfiguration {
|
||||||
) -> impl IntoElement + use<> {
|
) -> impl IntoElement + use<> {
|
||||||
let provider_id = provider.id().0.clone();
|
let provider_id = provider.id().0.clone();
|
||||||
let provider_name = provider.name().0.clone();
|
let provider_name = provider.name().0.clone();
|
||||||
|
let provider_id_string = SharedString::from(format!("provider-disclosure-{provider_id}"));
|
||||||
|
|
||||||
let configuration_view = self
|
let configuration_view = self
|
||||||
.configuration_views_by_provider
|
.configuration_views_by_provider
|
||||||
.get(&provider.id())
|
.get(&provider.id())
|
||||||
|
@ -160,13 +162,24 @@ impl AgentConfiguration {
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
.pt_3()
|
.py_2()
|
||||||
.gap_1p5()
|
.gap_1p5()
|
||||||
.border_t_1()
|
.border_t_1()
|
||||||
.border_color(cx.theme().colors().border.opacity(0.6))
|
.border_color(cx.theme().colors().border.opacity(0.6))
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
|
.w_full()
|
||||||
|
.gap_1()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
|
.child(
|
||||||
|
h_flex()
|
||||||
|
.id(provider_id_string.clone())
|
||||||
|
.cursor_pointer()
|
||||||
|
.py_0p5()
|
||||||
|
.w_full()
|
||||||
|
.justify_between()
|
||||||
|
.rounded_sm()
|
||||||
|
.hover(|hover| hover.bg(cx.theme().colors().element_hover))
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
|
@ -176,43 +189,20 @@ impl AgentConfiguration {
|
||||||
.color(Color::Muted),
|
.color(Color::Muted),
|
||||||
)
|
)
|
||||||
.child(Label::new(provider_name.clone()).size(LabelSize::Large))
|
.child(Label::new(provider_name.clone()).size(LabelSize::Large))
|
||||||
.when(provider.is_authenticated(cx) && !is_expanded, |parent| {
|
.when(
|
||||||
parent.child(Icon::new(IconName::Check).color(Color::Success))
|
provider.is_authenticated(cx) && !is_expanded,
|
||||||
}),
|
|parent| {
|
||||||
)
|
|
||||||
.child(
|
|
||||||
h_flex()
|
|
||||||
.gap_1()
|
|
||||||
.when(provider.is_authenticated(cx), |parent| {
|
|
||||||
parent.child(
|
parent.child(
|
||||||
Button::new(
|
Icon::new(IconName::Check).color(Color::Success),
|
||||||
SharedString::from(format!("new-thread-{provider_id}")),
|
|
||||||
"Start New Thread",
|
|
||||||
)
|
)
|
||||||
.icon_position(IconPosition::Start)
|
},
|
||||||
.icon(IconName::Plus)
|
),
|
||||||
.icon_size(IconSize::Small)
|
|
||||||
.layer(ElevationIndex::ModalSurface)
|
|
||||||
.label_size(LabelSize::Small)
|
|
||||||
.on_click(cx.listener({
|
|
||||||
let provider = provider.clone();
|
|
||||||
move |_this, _event, _window, cx| {
|
|
||||||
cx.emit(AssistantConfigurationEvent::NewThread(
|
|
||||||
provider.clone(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
})),
|
|
||||||
)
|
)
|
||||||
})
|
|
||||||
.child(
|
.child(
|
||||||
Disclosure::new(
|
Disclosure::new(provider_id_string, is_expanded)
|
||||||
SharedString::from(format!(
|
|
||||||
"provider-disclosure-{provider_id}"
|
|
||||||
)),
|
|
||||||
is_expanded,
|
|
||||||
)
|
|
||||||
.opened_icon(IconName::ChevronUp)
|
.opened_icon(IconName::ChevronUp)
|
||||||
.closed_icon(IconName::ChevronDown)
|
.closed_icon(IconName::ChevronDown),
|
||||||
|
)
|
||||||
.on_click(cx.listener({
|
.on_click(cx.listener({
|
||||||
let provider_id = provider.id().clone();
|
let provider_id = provider.id().clone();
|
||||||
move |this, _event, _window, _cx| {
|
move |this, _event, _window, _cx| {
|
||||||
|
@ -224,8 +214,28 @@ impl AgentConfiguration {
|
||||||
*is_expanded = !*is_expanded;
|
*is_expanded = !*is_expanded;
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
),
|
)
|
||||||
),
|
.when(provider.is_authenticated(cx), |parent| {
|
||||||
|
parent.child(
|
||||||
|
Button::new(
|
||||||
|
SharedString::from(format!("new-thread-{provider_id}")),
|
||||||
|
"Start New Thread",
|
||||||
|
)
|
||||||
|
.icon_position(IconPosition::Start)
|
||||||
|
.icon(IconName::Plus)
|
||||||
|
.icon_size(IconSize::Small)
|
||||||
|
.icon_color(Color::Muted)
|
||||||
|
.label_size(LabelSize::Small)
|
||||||
|
.on_click(cx.listener({
|
||||||
|
let provider = provider.clone();
|
||||||
|
move |_this, _event, _window, cx| {
|
||||||
|
cx.emit(AssistantConfigurationEvent::NewThread(
|
||||||
|
provider.clone(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
.when(is_expanded, |parent| match configuration_view {
|
.when(is_expanded, |parent| match configuration_view {
|
||||||
Some(configuration_view) => parent.child(configuration_view),
|
Some(configuration_view) => parent.child(configuration_view),
|
||||||
|
@ -244,11 +254,11 @@ impl AgentConfiguration {
|
||||||
v_flex()
|
v_flex()
|
||||||
.p(DynamicSpacing::Base16.rems(cx))
|
.p(DynamicSpacing::Base16.rems(cx))
|
||||||
.pr(DynamicSpacing::Base20.rems(cx))
|
.pr(DynamicSpacing::Base20.rems(cx))
|
||||||
.gap_4()
|
|
||||||
.border_b_1()
|
.border_b_1()
|
||||||
.border_color(cx.theme().colors().border)
|
.border_color(cx.theme().colors().border)
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
|
.mb_2p5()
|
||||||
.gap_0p5()
|
.gap_0p5()
|
||||||
.child(Headline::new("LLM Providers"))
|
.child(Headline::new("LLM Providers"))
|
||||||
.child(
|
.child(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue