Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/settings_ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ agent_settings.workspace = true
agent_skills.workspace = true
anyhow.workspace = true
audio.workspace = true
cloud_api_types.workspace = true
component.workspace = true
codestral.workspace = true
copilot.workspace = true
Expand Down
11 changes: 10 additions & 1 deletion crates/settings_ui/src/components/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use std::rc::Rc;
use gpui::{App, ElementId, IntoElement, RenderOnce};
use heck::ToTitleCase as _;
use ui::{
ButtonSize, ContextMenu, DropdownMenu, DropdownStyle, FluentBuilder as _, IconPosition, px,
ButtonSize, ContextMenu, Disableable as _, DropdownMenu, DropdownStyle, FluentBuilder as _,
IconPosition, px,
};

#[derive(IntoElement)]
Expand All @@ -17,6 +18,7 @@ where
labels: &'static [&'static str],
should_do_title_case: bool,
tab_index: Option<isize>,
disabled: bool,
on_change: Rc<dyn Fn(T, &mut ui::Window, &mut App) + 'static>,
}

Expand All @@ -38,6 +40,7 @@ where
labels,
should_do_title_case: true,
tab_index: None,
disabled: false,
on_change: Rc::new(on_change),
}
}
Expand All @@ -51,6 +54,11 @@ where
self.tab_index = Some(tab_index);
self
}

pub fn disabled(mut self, disabled: bool) -> Self {
self.disabled = disabled;
self
}
}

impl<T> RenderOnce for EnumVariantDropdown<T>
Expand Down Expand Up @@ -96,6 +104,7 @@ where
},
context_menu,
)
.disabled(self.disabled)
.when_some(self.tab_index, |elem, tab_index| elem.tab_index(tab_index))
.trigger_size(ButtonSize::Medium)
.style(DropdownStyle::Outlined)
Expand Down
Loading
Loading