diff --git a/crates/client/src/gui/builder/log.rs b/crates/client/src/gui/builder/log.rs index 1ee68c6..795bfa0 100644 --- a/crates/client/src/gui/builder/log.rs +++ b/crates/client/src/gui/builder/log.rs @@ -277,7 +277,13 @@ impl Yumush { let filters = toolbar(vec![ fixed(size::THUMB, field(palette, &self.chat.builder_log_actor)), fixed(size::THUMB, field(palette, &self.chat.builder_log_target)), - fixed(size::THUMB, Select::new(&self.chat.builder_log_action)), + fixed( + size::THUMB, + crate::gui::widget::underline( + palette, + Select::new(&self.chat.builder_log_action).appearance(false), + ), + ), fixed(size::THUMB, field(palette, &self.chat.builder_log_from)), fixed(size::THUMB, field(palette, &self.chat.builder_log_to)), accent_button( diff --git a/crates/client/src/gui/composer.rs b/crates/client/src/gui/composer.rs index 359b164..484076c 100644 --- a/crates/client/src/gui/composer.rs +++ b/crates/client/src/gui/composer.rs @@ -21,7 +21,6 @@ use gpui_kit::{ assets::IconName, component::{ Icon, WindowExt, - checkbox::Checkbox, input::{InputEvent, InputState, TextareaState}, notification::Notification, popover::Popover, @@ -756,24 +755,30 @@ pub fn plus_popover(chat: &Chat, entity: &Entity, palette: Palette) -> i .items_center() .gap(px(space::MD)) .child( - Checkbox::new("poll_multiple") - .label(w().composer.multiple_answers) - .checked(multiple) - .on_click(move |_, _, cx| { + super::parts::labeled_toggle( + "poll_multiple", + w().composer.multiple_answers, + multiple, + palette.tokens, + move |_, cx| { toggle.update(cx, |yumush, cx| { yumush.chat.poll_multiple = !yumush.chat.poll_multiple; cx.notify(); }) - }), + }, + ), ) .child( - Checkbox::new("poll_public") - .label(w().composer.show_voters) - .checked(public) - .on_click(move |_, _, cx| { + super::parts::labeled_toggle( + "poll_public", + w().composer.show_voters, + public, + palette.tokens, + move |_, cx| { toggle_public .update(cx, |yumush, cx| yumush.toggle_poll_public(cx)) - }), + }, + ), ), ), ) diff --git a/crates/client/src/gui/forward.rs b/crates/client/src/gui/forward.rs index 7f67e6e..916c995 100644 --- a/crates/client/src/gui/forward.rs +++ b/crates/client/src/gui/forward.rs @@ -7,7 +7,6 @@ use gpui_kit::{ StatefulInteractiveElement, Styled, Window, component::{ WindowExt, - checkbox::Checkbox, input::{InputEvent, InputState}, }, div, px, @@ -110,15 +109,18 @@ impl Render for Forward { .gap(px(space::MD)) .child(compact_field(palette, &self.filter)) .child( - Checkbox::new("keep_authors") - .label(w().forward.keep_authors) - .checked(keep_authors) - .on_click(move |_, _, cx| { + super::parts::labeled_toggle( + "keep_authors", + w().forward.keep_authors, + keep_authors, + palette.tokens, + move |_, cx| { entity.update(cx, |this, cx| { this.keep_authors = !this.keep_authors; cx.notify(); }); - }), + }, + ), ) .child( div() diff --git a/crates/client/src/gui/parts.rs b/crates/client/src/gui/parts.rs index f61dd75..fe4579c 100644 --- a/crates/client/src/gui/parts.rs +++ b/crates/client/src/gui/parts.rs @@ -148,6 +148,21 @@ pub fn track(fill: Fill, bad: bool, t: Tokens) -> Div { } } +pub fn labeled_toggle( + id: impl Into, + label: &'static str, + on: bool, + t: Tokens, + flip: impl Fn(&mut Window, &mut App) + 'static, +) -> Div { + div() + .flex() + .items_center() + .gap(px(space::SM)) + .child(words(label, Text::Caption, Ink::Dim, t)) + .child(toggle(id, on, t, flip)) +} + pub fn toggle( id: impl Into, on: bool, diff --git a/crates/client/src/gui/voice_settings.rs b/crates/client/src/gui/voice_settings.rs index 1d5afaf..07ec7ac 100644 --- a/crates/client/src/gui/voice_settings.rs +++ b/crates/client/src/gui/voice_settings.rs @@ -239,19 +239,19 @@ impl Yumush { let mut rows = vec![ row( w().voice_settings.input_device, - div().child( - Select::new(&controls.inputs) - .appearance(false) - .w(px(size::SIDEBAR)), - ), + super::widget::underline( + palette, + Select::new(&controls.inputs).appearance(false), + ) + .w(px(size::SIDEBAR)), ), row( w().voice_settings.output_device, - div().child( - Select::new(&controls.outputs) - .appearance(false) - .w(px(size::SIDEBAR)), - ), + super::widget::underline( + palette, + Select::new(&controls.outputs).appearance(false), + ) + .w(px(size::SIDEBAR)), ), row( w().voice_settings.input_volume, diff --git a/crates/client/src/gui/widget.rs b/crates/client/src/gui/widget.rs index 0f341b5..1633365 100644 --- a/crates/client/src/gui/widget.rs +++ b/crates/client/src/gui/widget.rs @@ -66,6 +66,16 @@ pub(super) fn frame(palette: Palette, input: Input) -> Div { .child(bare_input(palette, input)) } +pub(super) fn underline(palette: Palette, child: impl gpui_kit::IntoElement) -> Div { + div() + .h(px(size::CONTROL)) + .flex() + .items_center() + .border_b_1() + .border_color(palette.border) + .child(div().flex_1().min_w_0().child(child)) +} + pub(super) fn bare_input(palette: Palette, input: Input) -> Input { input .appearance(false)