diff --git a/crates/client/lang/en/community_settings.txt b/crates/client/lang/en/community_settings.txt index db8a35a..f68aeb7 100644 --- a/crates/client/lang/en/community_settings.txt +++ b/crates/client/lang/en/community_settings.txt @@ -12,7 +12,6 @@ oldest = Oldest on = On off = Off view = View -leave = Leave unban = Unban no_bans = No bans no_logs = No logs diff --git a/crates/client/lang/en/settings_page.txt b/crates/client/lang/en/settings_page.txt index 510aaee..c0b6940 100644 --- a/crates/client/lang/en/settings_page.txt +++ b/crates/client/lang/en/settings_page.txt @@ -3,16 +3,12 @@ voice = Voice camera_share = Camera & share appearance = Appearance title = Settings -back = Back identity = Identity name = Name status = Status presence = Presence -account = Account log_out = Log out delete_account = Delete account -danger_zone = Danger zone -delete = Delete confirm = Confirm save = Save remove = Remove @@ -28,3 +24,4 @@ quality = Quality frame_rate = Frame rate codec = Codec share_audio = Share audio +back_esc = esc · back to chat diff --git a/crates/client/lang/tr/community_settings.txt b/crates/client/lang/tr/community_settings.txt index 2fc06dc..c763c16 100644 --- a/crates/client/lang/tr/community_settings.txt +++ b/crates/client/lang/tr/community_settings.txt @@ -12,7 +12,6 @@ oldest = En eski on = Açık off = Kapalı view = Görüntüle -leave = Ayrıl unban = Yasağı kaldır no_bans = Yasak yok no_logs = Kayıt yok diff --git a/crates/client/lang/tr/settings_page.txt b/crates/client/lang/tr/settings_page.txt index cfa7846..6f61125 100644 --- a/crates/client/lang/tr/settings_page.txt +++ b/crates/client/lang/tr/settings_page.txt @@ -3,16 +3,12 @@ voice = Ses camera_share = Kamera ve paylaşım appearance = Görünüm title = Ayarlar -back = Geri identity = Kimlik name = Ad status = Durum presence = Görünürlük -account = Hesap log_out = Çıkış yap delete_account = Hesabı sil -danger_zone = Tehlikeli bölge -delete = Sil confirm = Onayla save = Kaydet remove = Kaldır @@ -28,3 +24,4 @@ quality = Kalite frame_rate = Kare hızı codec = Kodek share_audio = Sesi paylaş +back_esc = esc · sohbete dön diff --git a/crates/client/src/gui/builder.rs b/crates/client/src/gui/builder.rs index 89d346f..aad649f 100644 --- a/crates/client/src/gui/builder.rs +++ b/crates/client/src/gui/builder.rs @@ -21,9 +21,12 @@ use common::{ permission, }; use gpui_kit::{ - AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement, - ParentElement, StatefulInteractiveElement, Styled, Window, assets::IconName, - component::input::InputState, div, prelude::FluentBuilder as _, px, + AnyElement, App, Context, Entity, FontWeight, IntoElement, ParentElement, Styled, Window, + assets::IconName, + component::{Icon, input::InputState}, + div, + prelude::FluentBuilder as _, + px, }; use self::ui::{accent_button, icon_button, page_heading, plain_button}; @@ -31,7 +34,7 @@ use super::{ Palette, Yumush, chat::View, clickable, entity_action, notify_error, - settings_page::header, + settings_page::frame, style::{size, space, text}, text, widget::search_text, @@ -139,40 +142,30 @@ impl Yumush { ]; sections.extend(body); - div() - .flex_1() - .min_w_0() - .min_h_0() - .flex() - .flex_col() - .child(header(entity, palette, Role::Builder.label())) - .child( - div() - .flex_1() - .min_h_0() - .flex() - .child(self.builder_rail(entity, palette)) - .child( - div() - .id("builder_scroll") - .flex_1() - .min_w_0() - .min_h_0() - .overflow_y_scroll() - .child( - div() - .w_full() - .max_w(px(size::PAGE)) - .mx_auto() - .px(px(space::XXL)) - .py(px(space::XXL)) - .flex() - .flex_col() - .gap(px(space::XL)) - .children(sections), - ), - ), - ) + frame( + "builder_scroll", + entity, + palette, + div() + .flex() + .items_center() + .gap(px(space::SM)) + .child( + Icon::new(IconName::Shield) + .size(px(size::ICON)) + .text_color(palette.accent), + ) + .child(Role::Builder.label()), + BuilderTab::ALL + .map(|tab| { + self.builder_nav_item(tab, entity, palette) + .into_any_element() + }) + .into_iter() + .collect(), + vec![self.ghost_toggle(entity, palette).into_any_element()], + sections, + ) } fn tab_actions( @@ -222,20 +215,6 @@ impl Yumush { } } - fn builder_rail(&self, entity: &Entity, palette: Palette) -> Div { - div() - .w(px(size::SIDEBAR)) - .flex_shrink_0() - .flex() - .flex_col() - .gap(px(space::XXS)) - .px(px(space::XL)) - .py(px(space::LG)) - .children(BuilderTab::ALL.map(|tab| self.builder_nav_item(tab, entity, palette))) - .child(div().flex_1()) - .child(self.ghost_toggle(entity, palette)) - } - fn builder_nav_item( &self, tab: BuilderTab, @@ -256,7 +235,7 @@ impl Yumush { yumush.select_builder_tab(tab, window, cx) }), ) - .h(px(size::CONTROL)) + .h(px(size::CONTROL_SM + space::XS)) .flex() .items_center() .gap(px(space::SM)) @@ -266,7 +245,7 @@ impl Yumush { .children(open.map(|count| { div() .text_size(text(text::CAPTION)) - .text_color(palette.text) + .text_color(palette.danger) .child(count.to_string()) })) } @@ -279,7 +258,6 @@ impl Yumush { div() .h(px(size::CONTROL)) - .px(px(space::MD)) .flex() .items_center() .justify_between() diff --git a/crates/client/src/gui/builder/access.rs b/crates/client/src/gui/builder/access.rs index d119eb1..642a8c4 100644 --- a/crates/client/src/gui/builder/access.rs +++ b/crates/client/src/gui/builder/access.rs @@ -5,7 +5,7 @@ use common::{ }; use gpui_kit::{ AnyElement, ClipboardItem, Context, Div, Entity, FontWeight, IntoElement, ParentElement, - Styled, Window, assets::IconName, div, prelude::FluentBuilder as _, px, + Styled, Window, assets::IconName, div, px, }; use super::ui::{ @@ -26,14 +26,7 @@ fn list_card(header: Div, rows: Vec
, empty: &str, palette: Palette) -> Div .text_color(palette.muted) .child(empty.to_string()) } else { - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) + div().flex().flex_col().children(rows) }; card(palette).child(header).child(body) diff --git a/crates/client/src/gui/builder/backups.rs b/crates/client/src/gui/builder/backups.rs index 313ec3b..2ac2dd3 100644 --- a/crates/client/src/gui/builder/backups.rs +++ b/crates/client/src/gui/builder/backups.rs @@ -4,7 +4,7 @@ use common::{ }; use gpui_kit::{ Context, Div, Entity, IntoElement, ParentElement, Styled, Window, assets::IconName, - component::Icon, div, prelude::FluentBuilder as _, px, + component::Icon, div, px, }; use super::{ @@ -108,14 +108,7 @@ impl Yumush { .text_color(palette.muted) .child(w().builder_backups.no_backups) } else { - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) + div().flex().flex_col().children(rows) }; card(palette) diff --git a/crates/client/src/gui/builder/communities.rs b/crates/client/src/gui/builder/communities.rs index c216680..bc440f6 100644 --- a/crates/client/src/gui/builder/communities.rs +++ b/crates/client/src/gui/builder/communities.rs @@ -297,18 +297,11 @@ impl Yumush { vec![ card(palette) .child( - div() - .px(px(space::LG)) - .py(px(space::MD)) - .flex() - .items_center() - .border_b_1() - .border_color(palette.border) - .child( - div() - .w(px(size::SIDEBAR)) - .child(Input::new(&self.chat.builder_search)), - ), + div().pb(px(space::SM)).flex().items_center().child( + div() + .w(px(size::SIDEBAR)) + .child(Input::new(&self.chat.builder_search)), + ), ) .child(rows_body(rows, w().builder_communities.empty, palette)) .into_any_element(), diff --git a/crates/client/src/gui/builder/log.rs b/crates/client/src/gui/builder/log.rs index 5fa67f7..7573372 100644 --- a/crates/client/src/gui/builder/log.rs +++ b/crates/client/src/gui/builder/log.rs @@ -7,9 +7,7 @@ use gpui_kit::{ AnyElement, Context, Div, Entity, IntoElement, ParentElement, Styled, Window, assets::IconName, component::{Icon, WindowExt, notification::Notification, select::Select}, - div, - prelude::FluentBuilder as _, - px, + div, px, }; use jiff::Timestamp; @@ -296,12 +294,7 @@ impl Yumush { .chat .builder_logs .iter() - .enumerate() - .map(|(index, entry)| { - builder_log_row(entry, palette).when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - }) + .map(|entry| builder_log_row(entry, palette)) .collect(); let body = if rows.is_empty() { div() @@ -317,14 +310,7 @@ impl Yumush { vec![ card(palette) - .child( - div() - .px(px(space::LG)) - .py(px(space::MD)) - .border_b_1() - .border_color(palette.border) - .child(filters), - ) + .child(div().pb(px(space::SM)).child(filters)) .child(body) .into_any_element(), ] diff --git a/crates/client/src/gui/builder/storage.rs b/crates/client/src/gui/builder/storage.rs index 726ef69..a99b28b 100644 --- a/crates/client/src/gui/builder/storage.rs +++ b/crates/client/src/gui/builder/storage.rs @@ -7,9 +7,7 @@ use gpui_kit::{ AnyElement, Context, Div, Entity, FontWeight, IntoElement, ParentElement, Styled, Window, assets::IconName, component::{Icon, WindowExt, notification::Notification}, - div, - prelude::FluentBuilder as _, - px, relative, + div, px, relative, }; use super::ui::{ @@ -260,14 +258,7 @@ impl Yumush { .text_color(palette.muted) .child(w().builder_storage.no_attachments) } else { - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) + div().flex().flex_col().children(rows) }; let attachments = card(palette) .child(card_header( diff --git a/crates/client/src/gui/builder/ui.rs b/crates/client/src/gui/builder/ui.rs index 730e440..8d44627 100644 --- a/crates/client/src/gui/builder/ui.rs +++ b/crates/client/src/gui/builder/ui.rs @@ -1,5 +1,5 @@ use crate::gui::style::{radius, size, space, text}; -use crate::gui::{Palette, Tooltip as _, clickable, primary_button, text, widget}; +use crate::gui::{Palette, Tooltip as _, clickable, text, widget}; use crate::lang::w; use gpui_kit::{ AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window, @@ -124,9 +124,7 @@ pub(super) fn confirm_button( palette, action, ) - .when(pending, |this| { - this.bg(palette.danger).text_color(palette.on_accent) - }) + .when(pending, |this| this.font_weight(FontWeight::SEMIBOLD)) } pub(super) fn action_group( @@ -185,10 +183,7 @@ pub(super) fn danger_button( .flex() .items_center() .rounded(px(radius::MD)) - .text_size(text(text::CAPTION)) - .font_weight(FontWeight::MEDIUM) - .border_1() - .border_color(palette.border) + .text_size(text(text::UI)) .text_color(palette.danger) .child(label) } @@ -222,14 +217,7 @@ pub(super) fn rows_body(rows: Vec
, empty: &str, palette: Palette) -> Div { .text_color(palette.muted) .child(empty.to_string()); } - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) + div().flex().flex_col().children(rows) } pub(super) fn accent_button( @@ -238,14 +226,15 @@ pub(super) fn accent_button( palette: Palette, action: impl Fn(&mut Window, &mut App) + 'static, ) -> impl IntoElement { - primary_button(id, palette, action) + clickable(id, palette, action) .h(px(size::CONTROL_SM)) - .px(px(space::MD)) + .px(px(space::SM)) .flex() .items_center() .rounded(px(radius::MD)) - .text_size(text(text::CAPTION)) + .text_size(text(text::UI)) .font_weight(FontWeight::MEDIUM) + .text_color(palette.tokens.paper()) .child(label) } @@ -267,30 +256,21 @@ pub(super) fn plain_button( .child(label) } -pub(super) fn card(palette: Palette) -> Div { - div() - .flex() - .flex_col() - .rounded(px(radius::MD)) - .bg(palette.panel) - .overflow_hidden() +pub(super) fn card(_palette: Palette) -> Div { + div().flex().flex_col() } pub(super) fn card_header(title: &str, actions: Vec, palette: Palette) -> Div { div() - .px(px(space::LG)) - .py(px(space::MD)) + .pb(px(space::XS)) .flex() .items_center() .justify_between() .gap(px(space::SM)) - .border_b_1() - .border_color(palette.border) .child( div() - .text_size(text(text::LABEL)) - .font_weight(FontWeight::MEDIUM) - .text_color(palette.text) + .text_size(text(text::CAPTION)) + .text_color(palette.tokens.faint()) .child(title.to_string()), ) .children(actions) @@ -306,14 +286,7 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec
, empty: &str, palett .text_color(palette.muted) .child(empty.to_string()) } else { - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) + div().flex().flex_col().children(rows) }; card(palette) @@ -324,8 +297,7 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec
, empty: &str, palett pub(super) fn list_row() -> Div { div() .min_h(px(size::ROW)) - .px(px(space::LG)) - .py(px(space::MD)) + .py(px(space::SM)) .flex() .items_center() .gap(px(space::MD)) @@ -342,12 +314,10 @@ pub(super) fn toolbar(items: Vec) -> Div { pub(super) fn stat_tile(label: &str, value: &str, palette: Palette) -> Div { card(palette) - .p(px(space::LG)) - .gap(px(space::XS)) + .gap(px(space::XXS)) .child( div() - .text_size(text(text::TITLE)) - .font_weight(FontWeight::SEMIBOLD) + .text_size(text(text::DISPLAY)) .text_color(palette.text) .child(value.to_string()), ) @@ -390,11 +360,8 @@ pub(super) fn field_row( } pub(super) fn pill(label: &str, color: Hsla, palette: Palette) -> Div { + let _ = palette; div() - .px(px(space::SM)) - .py(px(space::XXS)) - .rounded(px(radius::SM)) - .bg(palette.hover) .text_size(text(text::CAPTION)) .text_color(color) .child(label.to_string()) diff --git a/crates/client/src/gui/builder/users.rs b/crates/client/src/gui/builder/users.rs index 3e19198..24fe1e4 100644 --- a/crates/client/src/gui/builder/users.rs +++ b/crates/client/src/gui/builder/users.rs @@ -461,14 +461,11 @@ impl Yumush { }; let toolbar = div() - .px(px(space::LG)) - .py(px(space::MD)) + .pb(px(space::SM)) .flex() .flex_wrap() .items_center() .gap(px(space::SM)) - .border_b_1() - .border_color(palette.border) .child( div() .flex_1() @@ -505,14 +502,7 @@ impl Yumush { .text_color(palette.muted) .child(w().builder_users.no_users) } else { - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) + div().flex().flex_col().children(rows) }; vec![card(palette).child(toolbar).child(body).into_any_element()] @@ -1076,11 +1066,12 @@ impl Yumush { .flex() .flex_col() .gap(px(space::SM)) - .px(px(space::LG)) - .py(px(space::MD)) - .bg(palette.window) - .border_t_1() - .border_color(palette.border) + .ml(px(space::MD)) + .mb(px(space::MD)) + .pl(px(space::XL)) + .py(px(space::SM)) + .border_l(px(crate::gui::style::stroke::LINE)) + .border_color(palette.tokens.person(user.id)) .children(action_group( w().builder_users.group_account, palette, diff --git a/crates/client/src/gui/community_settings.rs b/crates/client/src/gui/community_settings.rs index e13db3d..7641f1a 100644 --- a/crates/client/src/gui/community_settings.rs +++ b/crates/client/src/gui/community_settings.rs @@ -19,9 +19,7 @@ use gpui_kit::{ input::{Input, InputState}, notification::Notification, }, - div, - prelude::FluentBuilder as _, - px, + div, px, }; use super::{ @@ -30,8 +28,8 @@ use super::{ clickable, community_icon, entity_action, millis_time, notify_error, profile::user_link, settings_page::{ - Editable, Picture, Section, danger_section, delete_control, page, picked_avatar, - picture_card, row, section, small_button, text_row, + Editable, Picture, Section, delete_control, page, picked_avatar, picture_card, row, + section, small_button, text_row, with_danger, }, style::{radius, size, space, text as text_token}, text, @@ -190,25 +188,24 @@ impl Yumush { } let mut danger = Vec::new(); if let Some(community) = community.filter(|_| permission::can_leave(actor)) { - danger.push(row( - w().community_settings.leave_community, - leave_control(entity, community.id, palette), - )); + danger.push(leave_control(entity, community.id, palette).into_any_element()); } if permission::can_delete_community(actor) { - danger.push(row( - w().community_settings.delete_community, + danger.push( delete_control( "delete_community_button", + w().community_settings.delete_community, self.chat.delete_step, entity, palette, Yumush::delete_community, - ), - )); + ) + .into_any_element(), + ); } - if !danger.is_empty() { - sections.push(danger_section(palette, danger)); + if !sections.is_empty() { + let first = sections.remove(0); + sections.insert(0, with_danger(first, danger)); } page( @@ -496,8 +493,6 @@ fn voice_control( }); }, ) - .border_1() - .border_color(palette.border) .child(if enabled { w().community_settings.on } else { @@ -512,8 +507,6 @@ fn view_control( open: fn(&mut Yumush, &mut Window, &mut Context), ) -> impl IntoElement { small_button(id, palette, palette.text, entity_action(entity, open)) - .border_1() - .border_color(palette.border) .child(w().community_settings.view) } @@ -528,11 +521,7 @@ fn sort_control( .h(px(size::CONTROL_SM)) .p(px(space::XXS)) .flex() - .gap(px(space::XXS)) - .rounded(px(radius::MD)) - .border_1() - .border_color(palette.border) - .bg(palette.field) + .gap(px(space::MD)) .children(options.map(|(choice, id, label)| { let active = choice == selected; @@ -549,7 +538,12 @@ fn sort_control( .rounded(px(radius::SM)) .text_size(text(text_token::CAPTION)) .text_color(if active { palette.text } else { palette.muted }) - .when(active, |this| this.bg(palette.hover)) + .border_b(px(super::style::stroke::LINE)) + .border_color(if active { + palette.tokens.paper() + } else { + gpui_kit::transparent_black() + }) .child(label) })) } @@ -693,9 +687,7 @@ fn leave_control(entity: &Entity, community_id: Id, palette: Palette) -> }); }, ) - .border_1() - .border_color(palette.border) - .child(w().community_settings.leave) + .child(w().community_settings.leave_community) } fn ban_row( diff --git a/crates/client/src/gui/settings_page.rs b/crates/client/src/gui/settings_page.rs index 49c357b..0a95cb6 100644 --- a/crates/client/src/gui/settings_page.rs +++ b/crates/client/src/gui/settings_page.rs @@ -10,19 +10,15 @@ use common::{ use gpui_kit::{ AnyElement, App, AsyncWindowContext, Context, Div, Entity, FontWeight, Hsla, InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful, - StatefulInteractiveElement, Styled, WeakEntity, Window, - assets::IconName, - component::{Icon, input::InputState}, - div, - prelude::FluentBuilder as _, - px, transparent_black, + StatefulInteractiveElement, Styled, WeakEntity, Window, component::input::InputState, div, + prelude::FluentBuilder as _, px, transparent_black, }; use super::{ Palette, Tooltip as _, Yumush, avatar, chat::DeleteStep, chat::View, - clickable, notify_error, parts, primary_button, + clickable, notify_error, parts, share_view::{AudioMode, FPS, RESOLUTIONS, codecs, share_modes}, text, widget::field, @@ -50,7 +46,6 @@ impl Yumush { let mut sections = Vec::new(); if let Some(user) = self.user.as_ref() { let presence_entity = entity.clone(); - let logout_entity = entity.clone(); sections.push(Section( settings_titles()[0], div() @@ -123,26 +118,6 @@ impl Yumush { ], ), )) - .child(titled( - w().settings_page.account, - palette, - rows_column( - palette, - vec![row( - w().settings_page.log_out, - small_button( - "logout_button", - palette, - palette.danger, - move |window, cx| { - logout_entity - .update(cx, |yumush, cx| yumush.logout(window, cx)) - }, - ) - .child(w().settings_page.log_out), - )], - ), - )) .into_any_element(), )); } @@ -211,20 +186,33 @@ impl Yumush { )); } sections.push(section(settings_titles()[3], palette, appearance)); - if self.user.is_some() { - sections.push(danger_section( - palette, - vec![row( - w().settings_page.delete_account, - delete_control( - "delete_account_button", - self.chat.delete_step, - entity, - palette, - Yumush::delete_account, - ), - )], - )); + if self.user.is_some() && !sections.is_empty() { + let profile = sections.remove(0); + sections.insert( + 0, + with_danger( + profile, + vec![ + small_button("logout_button", palette, palette.muted, { + let entity = entity.clone(); + move |window, cx| { + entity.update(cx, |yumush, cx| yumush.logout(window, cx)) + } + }) + .child(w().settings_page.log_out) + .into_any_element(), + delete_control( + "delete_account_button", + w().settings_page.delete_account, + self.chat.delete_step, + entity, + palette, + Yumush::delete_account, + ) + .into_any_element(), + ], + ), + ); } page( @@ -562,35 +550,6 @@ pub(super) fn picked_avatar( } } -pub(super) fn header( - entity: &Entity, - palette: Palette, - title: impl IntoElement, -) -> impl IntoElement { - let entity = entity.clone(); - - div() - .h(px(size::ROW)) - .px(px(space::LG)) - .flex() - .items_center() - .child( - clickable("settings_back_button", palette, move |window, cx| { - entity.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx)); - }) - .tip(w().settings_page.back) - .h(px(size::CONTROL_SM)) - .px(px(space::SM)) - .rounded(px(radius::MD)) - .flex() - .items_center() - .gap(px(space::XS)) - .font_weight(FontWeight::MEDIUM) - .child(Icon::new(IconName::ChevronLeft).size(px(size::ICON_SM))) - .child(title), - ) -} - pub(super) struct Section(pub &'static str, pub AnyElement); pub(super) fn page( @@ -619,6 +578,7 @@ pub(super) fn page( }) }, ) + .into_any_element() }) .collect(); let body = sections @@ -626,42 +586,80 @@ pub(super) fn page( .nth(selected) .map(|Section(_, body)| body); + frame( + id, + entity, + palette, + title, + index, + Vec::new(), + body.into_iter().collect(), + ) +} + +pub(super) fn frame( + id: &'static str, + entity: &Entity, + palette: Palette, + title: impl IntoElement, + index: Vec, + footer: Vec, + body: Vec, +) -> Div { + let back = entity.clone(); + div() .flex_1() + .min_w_0() .min_h_0() .flex() - .flex_col() - .child(header(entity, palette, title)) .child( div() - .flex_1() - .min_h_0() + .w(px(size::SIDEBAR)) + .flex_shrink_0() + .px(px(space::XL)) + .py(px(space::XL)) .flex() + .flex_col() + .border_r(px(stroke::LINE)) + .border_color(palette.tokens.thread()) .child( div() - .w(px(size::SIDEBAR)) - .flex_shrink_0() - .px(px(space::XL)) - .py(px(space::LG)) - .flex() - .flex_col() - .children(index), + .pb(px(space::XL)) + .text_size(text(text::TITLE)) + .text_color(palette.tokens.paper()) + .child(title), ) + .children(index) + .child(div().flex_1()) + .children(footer) + .child( + clickable("page_back", palette, move |window, cx| { + back.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx)); + }) + .pt(px(space::MD)) + .text_size(text(text::CAPTION)) + .text_color(palette.tokens.faint()) + .child(w().settings_page.back_esc), + ), + ) + .child( + div() + .id(id) + .flex_1() + .min_w_0() + .min_h_0() + .overflow_y_scroll() .child( div() - .id(id) - .flex_1() - .min_w_0() - .min_h_0() - .overflow_y_scroll() - .child( - div() - .w_full() - .max_w(px(size::PAGE)) - .px(px(space::XL)) - .py(px(space::LG)) - .children(body), - ), + .w_full() + .max_w(px(size::PAGE)) + .px(px(space::XXL)) + .py(px(space::XL)) + .flex() + .flex_col() + .gap(px(space::XL)) + .children(body), ), ) } @@ -670,8 +668,26 @@ pub(super) fn section(title: &'static str, palette: Palette, rows: Vec
) -> Section(title, rows_column(palette, rows)) } -pub(super) fn danger_section(palette: Palette, rows: Vec
) -> Section { - Section(w().settings_page.danger_zone, rows_column(palette, rows)) +pub(super) fn with_danger(section: Section, actions: Vec) -> Section { + let Section(title, body) = section; + Section( + title, + div() + .flex() + .flex_col() + .gap(px(space::XXL)) + .child(body) + .when(!actions.is_empty(), |this| { + this.child( + div() + .flex() + .items_center() + .gap(px(space::LG)) + .children(actions), + ) + }) + .into_any_element(), + ) } fn titled(title: &'static str, palette: Palette, rows: impl IntoElement) -> Div { @@ -682,16 +698,8 @@ fn titled(title: &'static str, palette: Palette, rows: impl IntoElement) -> Div .child(rows) } -fn rows_column(palette: Palette, rows: Vec
) -> AnyElement { - div() - .flex() - .flex_col() - .children(rows.into_iter().enumerate().map(|(index, row)| { - row.when(index > 0, |row| { - row.border_t_1().border_color(palette.border) - }) - })) - .into_any_element() +fn rows_column(_palette: Palette, rows: Vec
) -> AnyElement { + div().flex().flex_col().children(rows).into_any_element() } pub(super) struct Editable<'a> { @@ -713,34 +721,32 @@ pub(super) fn text_row( let save = editable.save; div() - .p(px(space::MD)) + .min_h(px(size::ROW)) + .py(px(space::SM)) .flex() - .flex_col() - .gap(px(space::SM)) - .child( - div() - .text_size(text(text::CAPTION)) - .text_color(palette.muted) - .child(editable.label), - ) + .items_center() + .justify_between() + .gap(px(space::XL)) + .child(editable.label) .child( div() + .w(px(size::SIDEBAR)) + .flex_shrink_0() .flex() .items_center() .gap(px(space::SM)) .child(field(palette, editable.input).flex_1()) .when(dirty, |this| { this.child( - primary_button(editable.id, palette, move |window, cx| { + clickable(editable.id, palette, move |window, cx| { entity.update(cx, |yumush, cx| save(yumush, window, cx)); }) - .h(px(size::CONTROL)) - .px(px(space::LG)) - .flex() - .items_center() - .rounded(px(radius::MD)) - .font_weight(FontWeight::MEDIUM) - .child(w().settings_page.save), + .tip(w().settings_page.save) + .px(px(space::XS)) + .rounded(px(radius::SM)) + .text_size(text(text::CAPTION)) + .text_color(palette.tokens.paper()) + .child("↵"), ) }), ) @@ -832,16 +838,17 @@ pub(super) fn small_button( ) -> Stateful
{ clickable(id, palette, on_click) .h(px(size::CONTROL_SM)) - .px(px(space::MD)) + .px(px(space::SM)) .flex() .items_center() .rounded(px(radius::MD)) - .text_size(text(text::LABEL)) + .text_size(text(text::UI)) .text_color(color) } pub(super) fn delete_control( id: &'static str, + label: &'static str, step: DeleteStep, entity: &Entity, palette: Palette, @@ -853,23 +860,19 @@ pub(super) fn delete_control( small_button(id, palette, palette.danger, move |window, cx| { entity.update(cx, |yumush, cx| action(yumush, window, cx)); }) - .border_1() - .border_color(palette.border) - .when(confirming, |this| { - this.bg(palette.danger).text_color(palette.on_accent) - }) + .when(confirming, |this| this.font_weight(FontWeight::MEDIUM)) .child(if confirming { w().settings_page.confirm } else { - w().settings_page.delete + label }) } pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div { div() .min_h(px(size::ROW)) - .py(px(space::MD)) - .px(px(space::MD)) + .py(px(space::SM)) + .gap(px(space::XL)) .flex() .items_center() .justify_between() @@ -877,32 +880,22 @@ pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div { .child(control) } -pub(super) fn segment_track(palette: Palette) -> Div { - div() - .h(px(size::CONTROL)) - .p(px(space::XXS)) - .flex() - .gap(px(space::XXS)) - .rounded(px(radius::MD)) - .border_1() - .border_color(palette.border) - .bg(palette.window) +pub(super) fn segment_track(_palette: Palette) -> Div { + div().h(px(size::CONTROL)).flex().gap(px(space::LG)) } pub(super) fn segment(item: E, active: bool, palette: Palette) -> E { - let (background, border, text) = if active { - (palette.field, palette.border, palette.text) + let (border, text) = if active { + (palette.tokens.paper(), palette.tokens.paper()) } else { - (transparent_black(), transparent_black(), palette.muted) + (transparent_black(), palette.muted) }; item.flex() .items_center() .justify_center() - .rounded(px(radius::SM)) - .border_1() + .border_b(px(stroke::LINE)) .border_color(border) - .bg(background) .text_color(text) }