Full pages share one frame: titled index with an ink thread, esc back link, one column, no cards or row borders
Browse files at this commit9f9d7190cf13f931b8e64cbf267ec598205cbf06Parent: d045bcc- style
- full pages share one frame: titled index with an ink thread, esc back link, one column, no cards or row borders
14 changed files +238 -369
- crates/client/lang/en/community_settings.txt +0 -1
- crates/client/lang/en/settings_page.txt +1 -4
- crates/client/lang/tr/community_settings.txt +0 -1
- crates/client/lang/tr/settings_page.txt +1 -4
- crates/client/src/gui/builder.rs +33 -55
- crates/client/src/gui/builder/access.rs +2 -9
- crates/client/src/gui/builder/backups.rs +2 -9
- crates/client/src/gui/builder/communities.rs +5 -12
- crates/client/src/gui/builder/log.rs +3 -17
- crates/client/src/gui/builder/storage.rs +2 -11
- crates/client/src/gui/builder/ui.rs +18 -51
- crates/client/src/gui/builder/users.rs +8 -17
- crates/client/src/gui/community_settings.rs +20 -28
- crates/client/src/gui/settings_page.rs +143 -150
crates/client/lang/en/community_settings.txtmodified+0 -1
| @@ -12,7 +12,6 @@ oldest = Oldest | ||
| 12 | 12 | on = On |
| 13 | 13 | off = Off |
| 14 | 14 | view = View |
| 15 | -leave = Leave | |
| 16 | 15 | unban = Unban |
| 17 | 16 | no_bans = No bans |
| 18 | 17 | no_logs = No logs |
crates/client/lang/en/settings_page.txtmodified+1 -4
| @@ -3,16 +3,12 @@ voice = Voice | ||
| 3 | 3 | camera_share = Camera & share |
| 4 | 4 | appearance = Appearance |
| 5 | 5 | title = Settings |
| 6 | -back = Back | |
| 7 | 6 | identity = Identity |
| 8 | 7 | name = Name |
| 9 | 8 | status = Status |
| 10 | 9 | presence = Presence |
| 11 | -account = Account | |
| 12 | 10 | log_out = Log out |
| 13 | 11 | delete_account = Delete account |
| 14 | -danger_zone = Danger zone | |
| 15 | -delete = Delete | |
| 16 | 12 | confirm = Confirm |
| 17 | 13 | save = Save |
| 18 | 14 | remove = Remove |
| @@ -28,3 +24,4 @@ quality = Quality | ||
| 28 | 24 | frame_rate = Frame rate |
| 29 | 25 | codec = Codec |
| 30 | 26 | share_audio = Share audio |
| 27 | +back_esc = esc · back to chat |
crates/client/lang/tr/community_settings.txtmodified+0 -1
| @@ -12,7 +12,6 @@ oldest = En eski | ||
| 12 | 12 | on = Açık |
| 13 | 13 | off = Kapalı |
| 14 | 14 | view = Görüntüle |
| 15 | -leave = Ayrıl | |
| 16 | 15 | unban = Yasağı kaldır |
| 17 | 16 | no_bans = Yasak yok |
| 18 | 17 | no_logs = Kayıt yok |
crates/client/lang/tr/settings_page.txtmodified+1 -4
| @@ -3,16 +3,12 @@ voice = Ses | ||
| 3 | 3 | camera_share = Kamera ve paylaşım |
| 4 | 4 | appearance = Görünüm |
| 5 | 5 | title = Ayarlar |
| 6 | -back = Geri | |
| 7 | 6 | identity = Kimlik |
| 8 | 7 | name = Ad |
| 9 | 8 | status = Durum |
| 10 | 9 | presence = Görünürlük |
| 11 | -account = Hesap | |
| 12 | 10 | log_out = Çıkış yap |
| 13 | 11 | delete_account = Hesabı sil |
| 14 | -danger_zone = Tehlikeli bölge | |
| 15 | -delete = Sil | |
| 16 | 12 | confirm = Onayla |
| 17 | 13 | save = Kaydet |
| 18 | 14 | remove = Kaldır |
| @@ -28,3 +24,4 @@ quality = Kalite | ||
| 28 | 24 | frame_rate = Kare hızı |
| 29 | 25 | codec = Kodek |
| 30 | 26 | share_audio = Sesi paylaş |
| 27 | +back_esc = esc · sohbete dön |
crates/client/src/gui/builder.rsmodified+33 -55
| @@ -21,9 +21,12 @@ use common::{ | ||
| 21 | 21 | permission, |
| 22 | 22 | }; |
| 23 | 23 | use gpui_kit::{ |
| 24 | - AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement, | |
| 25 | - ParentElement, StatefulInteractiveElement, Styled, Window, assets::IconName, | |
| 26 | - component::input::InputState, div, prelude::FluentBuilder as _, px, | |
| 24 | + AnyElement, App, Context, Entity, FontWeight, IntoElement, ParentElement, Styled, Window, | |
| 25 | + assets::IconName, | |
| 26 | + component::{Icon, input::InputState}, | |
| 27 | + div, | |
| 28 | + prelude::FluentBuilder as _, | |
| 29 | + px, | |
| 27 | 30 | }; |
| 28 | 31 | |
| 29 | 32 | use self::ui::{accent_button, icon_button, page_heading, plain_button}; |
| @@ -31,7 +34,7 @@ use super::{ | ||
| 31 | 34 | Palette, Yumush, |
| 32 | 35 | chat::View, |
| 33 | 36 | clickable, entity_action, notify_error, |
| 34 | - settings_page::header, | |
| 37 | + settings_page::frame, | |
| 35 | 38 | style::{size, space, text}, |
| 36 | 39 | text, |
| 37 | 40 | widget::search_text, |
| @@ -139,40 +142,30 @@ impl Yumush { | ||
| 139 | 142 | ]; |
| 140 | 143 | sections.extend(body); |
| 141 | 144 | |
| 142 | - div() | |
| 143 | - .flex_1() | |
| 144 | - .min_w_0() | |
| 145 | - .min_h_0() | |
| 146 | - .flex() | |
| 147 | - .flex_col() | |
| 148 | - .child(header(entity, palette, Role::Builder.label())) | |
| 149 | - .child( | |
| 150 | - div() | |
| 151 | - .flex_1() | |
| 152 | - .min_h_0() | |
| 153 | - .flex() | |
| 154 | - .child(self.builder_rail(entity, palette)) | |
| 155 | - .child( | |
| 156 | - div() | |
| 157 | - .id("builder_scroll") | |
| 158 | - .flex_1() | |
| 159 | - .min_w_0() | |
| 160 | - .min_h_0() | |
| 161 | - .overflow_y_scroll() | |
| 162 | - .child( | |
| 163 | - div() | |
| 164 | - .w_full() | |
| 165 | - .max_w(px(size::PAGE)) | |
| 166 | - .mx_auto() | |
| 167 | - .px(px(space::XXL)) | |
| 168 | - .py(px(space::XXL)) | |
| 169 | - .flex() | |
| 170 | - .flex_col() | |
| 171 | - .gap(px(space::XL)) | |
| 172 | - .children(sections), | |
| 173 | - ), | |
| 174 | - ), | |
| 175 | - ) | |
| 145 | + frame( | |
| 146 | + "builder_scroll", | |
| 147 | + entity, | |
| 148 | + palette, | |
| 149 | + div() | |
| 150 | + .flex() | |
| 151 | + .items_center() | |
| 152 | + .gap(px(space::SM)) | |
| 153 | + .child( | |
| 154 | + Icon::new(IconName::Shield) | |
| 155 | + .size(px(size::ICON)) | |
| 156 | + .text_color(palette.accent), | |
| 157 | + ) | |
| 158 | + .child(Role::Builder.label()), | |
| 159 | + BuilderTab::ALL | |
| 160 | + .map(|tab| { | |
| 161 | + self.builder_nav_item(tab, entity, palette) | |
| 162 | + .into_any_element() | |
| 163 | + }) | |
| 164 | + .into_iter() | |
| 165 | + .collect(), | |
| 166 | + vec![self.ghost_toggle(entity, palette).into_any_element()], | |
| 167 | + sections, | |
| 168 | + ) | |
| 176 | 169 | } |
| 177 | 170 | |
| 178 | 171 | fn tab_actions( |
| @@ -222,20 +215,6 @@ impl Yumush { | ||
| 222 | 215 | } |
| 223 | 216 | } |
| 224 | 217 | |
| 225 | - fn builder_rail(&self, entity: &Entity<Self>, palette: Palette) -> Div { | |
| 226 | - div() | |
| 227 | - .w(px(size::SIDEBAR)) | |
| 228 | - .flex_shrink_0() | |
| 229 | - .flex() | |
| 230 | - .flex_col() | |
| 231 | - .gap(px(space::XXS)) | |
| 232 | - .px(px(space::XL)) | |
| 233 | - .py(px(space::LG)) | |
| 234 | - .children(BuilderTab::ALL.map(|tab| self.builder_nav_item(tab, entity, palette))) | |
| 235 | - .child(div().flex_1()) | |
| 236 | - .child(self.ghost_toggle(entity, palette)) | |
| 237 | - } | |
| 238 | - | |
| 239 | 218 | fn builder_nav_item( |
| 240 | 219 | &self, |
| 241 | 220 | tab: BuilderTab, |
| @@ -256,7 +235,7 @@ impl Yumush { | ||
| 256 | 235 | yumush.select_builder_tab(tab, window, cx) |
| 257 | 236 | }), |
| 258 | 237 | ) |
| 259 | - .h(px(size::CONTROL)) | |
| 238 | + .h(px(size::CONTROL_SM + space::XS)) | |
| 260 | 239 | .flex() |
| 261 | 240 | .items_center() |
| 262 | 241 | .gap(px(space::SM)) |
| @@ -266,7 +245,7 @@ impl Yumush { | ||
| 266 | 245 | .children(open.map(|count| { |
| 267 | 246 | div() |
| 268 | 247 | .text_size(text(text::CAPTION)) |
| 269 | - .text_color(palette.text) | |
| 248 | + .text_color(palette.danger) | |
| 270 | 249 | .child(count.to_string()) |
| 271 | 250 | })) |
| 272 | 251 | } |
| @@ -279,7 +258,6 @@ impl Yumush { | ||
| 279 | 258 | |
| 280 | 259 | div() |
| 281 | 260 | .h(px(size::CONTROL)) |
| 282 | - .px(px(space::MD)) | |
| 283 | 261 | .flex() |
| 284 | 262 | .items_center() |
| 285 | 263 | .justify_between() |
crates/client/src/gui/builder/access.rsmodified+2 -9
| @@ -5,7 +5,7 @@ use common::{ | ||
| 5 | 5 | }; |
| 6 | 6 | use gpui_kit::{ |
| 7 | 7 | AnyElement, ClipboardItem, Context, Div, Entity, FontWeight, IntoElement, ParentElement, |
| 8 | - Styled, Window, assets::IconName, div, prelude::FluentBuilder as _, px, | |
| 8 | + Styled, Window, assets::IconName, div, px, | |
| 9 | 9 | }; |
| 10 | 10 | |
| 11 | 11 | use super::ui::{ |
| @@ -26,14 +26,7 @@ fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div | ||
| 26 | 26 | .text_color(palette.muted) |
| 27 | 27 | .child(empty.to_string()) |
| 28 | 28 | } else { |
| 29 | - div() | |
| 30 | - .flex() | |
| 31 | - .flex_col() | |
| 32 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 33 | - row.when(index > 0, |row| { | |
| 34 | - row.border_t_1().border_color(palette.border) | |
| 35 | - }) | |
| 36 | - })) | |
| 29 | + div().flex().flex_col().children(rows) | |
| 37 | 30 | }; |
| 38 | 31 | |
| 39 | 32 | card(palette).child(header).child(body) |
crates/client/src/gui/builder/backups.rsmodified+2 -9
| @@ -4,7 +4,7 @@ use common::{ | ||
| 4 | 4 | }; |
| 5 | 5 | use gpui_kit::{ |
| 6 | 6 | Context, Div, Entity, IntoElement, ParentElement, Styled, Window, assets::IconName, |
| 7 | - component::Icon, div, prelude::FluentBuilder as _, px, | |
| 7 | + component::Icon, div, px, | |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | 10 | use super::{ |
| @@ -108,14 +108,7 @@ impl Yumush { | ||
| 108 | 108 | .text_color(palette.muted) |
| 109 | 109 | .child(w().builder_backups.no_backups) |
| 110 | 110 | } else { |
| 111 | - div() | |
| 112 | - .flex() | |
| 113 | - .flex_col() | |
| 114 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 115 | - row.when(index > 0, |row| { | |
| 116 | - row.border_t_1().border_color(palette.border) | |
| 117 | - }) | |
| 118 | - })) | |
| 111 | + div().flex().flex_col().children(rows) | |
| 119 | 112 | }; |
| 120 | 113 | |
| 121 | 114 | card(palette) |
crates/client/src/gui/builder/communities.rsmodified+5 -12
| @@ -297,18 +297,11 @@ impl Yumush { | ||
| 297 | 297 | vec![ |
| 298 | 298 | card(palette) |
| 299 | 299 | .child( |
| 300 | - div() | |
| 301 | - .px(px(space::LG)) | |
| 302 | - .py(px(space::MD)) | |
| 303 | - .flex() | |
| 304 | - .items_center() | |
| 305 | - .border_b_1() | |
| 306 | - .border_color(palette.border) | |
| 307 | - .child( | |
| 308 | - div() | |
| 309 | - .w(px(size::SIDEBAR)) | |
| 310 | - .child(Input::new(&self.chat.builder_search)), | |
| 311 | - ), | |
| 300 | + div().pb(px(space::SM)).flex().items_center().child( | |
| 301 | + div() | |
| 302 | + .w(px(size::SIDEBAR)) | |
| 303 | + .child(Input::new(&self.chat.builder_search)), | |
| 304 | + ), | |
| 312 | 305 | ) |
| 313 | 306 | .child(rows_body(rows, w().builder_communities.empty, palette)) |
| 314 | 307 | .into_any_element(), |
crates/client/src/gui/builder/log.rsmodified+3 -17
| @@ -7,9 +7,7 @@ use gpui_kit::{ | ||
| 7 | 7 | AnyElement, Context, Div, Entity, IntoElement, ParentElement, Styled, Window, |
| 8 | 8 | assets::IconName, |
| 9 | 9 | component::{Icon, WindowExt, notification::Notification, select::Select}, |
| 10 | - div, | |
| 11 | - prelude::FluentBuilder as _, | |
| 12 | - px, | |
| 10 | + div, px, | |
| 13 | 11 | }; |
| 14 | 12 | use jiff::Timestamp; |
| 15 | 13 | |
| @@ -296,12 +294,7 @@ impl Yumush { | ||
| 296 | 294 | .chat |
| 297 | 295 | .builder_logs |
| 298 | 296 | .iter() |
| 299 | - .enumerate() | |
| 300 | - .map(|(index, entry)| { | |
| 301 | - builder_log_row(entry, palette).when(index > 0, |row| { | |
| 302 | - row.border_t_1().border_color(palette.border) | |
| 303 | - }) | |
| 304 | - }) | |
| 297 | + .map(|entry| builder_log_row(entry, palette)) | |
| 305 | 298 | .collect(); |
| 306 | 299 | let body = if rows.is_empty() { |
| 307 | 300 | div() |
| @@ -317,14 +310,7 @@ impl Yumush { | ||
| 317 | 310 | |
| 318 | 311 | vec![ |
| 319 | 312 | card(palette) |
| 320 | - .child( | |
| 321 | - div() | |
| 322 | - .px(px(space::LG)) | |
| 323 | - .py(px(space::MD)) | |
| 324 | - .border_b_1() | |
| 325 | - .border_color(palette.border) | |
| 326 | - .child(filters), | |
| 327 | - ) | |
| 313 | + .child(div().pb(px(space::SM)).child(filters)) | |
| 328 | 314 | .child(body) |
| 329 | 315 | .into_any_element(), |
| 330 | 316 | ] |
crates/client/src/gui/builder/storage.rsmodified+2 -11
| @@ -7,9 +7,7 @@ use gpui_kit::{ | ||
| 7 | 7 | AnyElement, Context, Div, Entity, FontWeight, IntoElement, ParentElement, Styled, Window, |
| 8 | 8 | assets::IconName, |
| 9 | 9 | component::{Icon, WindowExt, notification::Notification}, |
| 10 | - div, | |
| 11 | - prelude::FluentBuilder as _, | |
| 12 | - px, relative, | |
| 10 | + div, px, relative, | |
| 13 | 11 | }; |
| 14 | 12 | |
| 15 | 13 | use super::ui::{ |
| @@ -260,14 +258,7 @@ impl Yumush { | ||
| 260 | 258 | .text_color(palette.muted) |
| 261 | 259 | .child(w().builder_storage.no_attachments) |
| 262 | 260 | } else { |
| 263 | - div() | |
| 264 | - .flex() | |
| 265 | - .flex_col() | |
| 266 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 267 | - row.when(index > 0, |row| { | |
| 268 | - row.border_t_1().border_color(palette.border) | |
| 269 | - }) | |
| 270 | - })) | |
| 261 | + div().flex().flex_col().children(rows) | |
| 271 | 262 | }; |
| 272 | 263 | let attachments = card(palette) |
| 273 | 264 | .child(card_header( |
crates/client/src/gui/builder/ui.rsmodified+18 -51
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | use crate::gui::style::{radius, size, space, text}; |
| 2 | -use crate::gui::{Palette, Tooltip as _, clickable, primary_button, text, widget}; | |
| 2 | +use crate::gui::{Palette, Tooltip as _, clickable, text, widget}; | |
| 3 | 3 | use crate::lang::w; |
| 4 | 4 | use gpui_kit::{ |
| 5 | 5 | AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window, |
| @@ -124,9 +124,7 @@ pub(super) fn confirm_button( | ||
| 124 | 124 | palette, |
| 125 | 125 | action, |
| 126 | 126 | ) |
| 127 | - .when(pending, |this| { | |
| 128 | - this.bg(palette.danger).text_color(palette.on_accent) | |
| 129 | - }) | |
| 127 | + .when(pending, |this| this.font_weight(FontWeight::SEMIBOLD)) | |
| 130 | 128 | } |
| 131 | 129 | |
| 132 | 130 | pub(super) fn action_group( |
| @@ -185,10 +183,7 @@ pub(super) fn danger_button( | ||
| 185 | 183 | .flex() |
| 186 | 184 | .items_center() |
| 187 | 185 | .rounded(px(radius::MD)) |
| 188 | - .text_size(text(text::CAPTION)) | |
| 189 | - .font_weight(FontWeight::MEDIUM) | |
| 190 | - .border_1() | |
| 191 | - .border_color(palette.border) | |
| 186 | + .text_size(text(text::UI)) | |
| 192 | 187 | .text_color(palette.danger) |
| 193 | 188 | .child(label) |
| 194 | 189 | } |
| @@ -222,14 +217,7 @@ pub(super) fn rows_body(rows: Vec<Div>, empty: &str, palette: Palette) -> Div { | ||
| 222 | 217 | .text_color(palette.muted) |
| 223 | 218 | .child(empty.to_string()); |
| 224 | 219 | } |
| 225 | - div() | |
| 226 | - .flex() | |
| 227 | - .flex_col() | |
| 228 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 229 | - row.when(index > 0, |row| { | |
| 230 | - row.border_t_1().border_color(palette.border) | |
| 231 | - }) | |
| 232 | - })) | |
| 220 | + div().flex().flex_col().children(rows) | |
| 233 | 221 | } |
| 234 | 222 | |
| 235 | 223 | pub(super) fn accent_button( |
| @@ -238,14 +226,15 @@ pub(super) fn accent_button( | ||
| 238 | 226 | palette: Palette, |
| 239 | 227 | action: impl Fn(&mut Window, &mut App) + 'static, |
| 240 | 228 | ) -> impl IntoElement { |
| 241 | - primary_button(id, palette, action) | |
| 229 | + clickable(id, palette, action) | |
| 242 | 230 | .h(px(size::CONTROL_SM)) |
| 243 | - .px(px(space::MD)) | |
| 231 | + .px(px(space::SM)) | |
| 244 | 232 | .flex() |
| 245 | 233 | .items_center() |
| 246 | 234 | .rounded(px(radius::MD)) |
| 247 | - .text_size(text(text::CAPTION)) | |
| 235 | + .text_size(text(text::UI)) | |
| 248 | 236 | .font_weight(FontWeight::MEDIUM) |
| 237 | + .text_color(palette.tokens.paper()) | |
| 249 | 238 | .child(label) |
| 250 | 239 | } |
| 251 | 240 | |
| @@ -267,30 +256,21 @@ pub(super) fn plain_button( | ||
| 267 | 256 | .child(label) |
| 268 | 257 | } |
| 269 | 258 | |
| 270 | -pub(super) fn card(palette: Palette) -> Div { | |
| 271 | - div() | |
| 272 | - .flex() | |
| 273 | - .flex_col() | |
| 274 | - .rounded(px(radius::MD)) | |
| 275 | - .bg(palette.panel) | |
| 276 | - .overflow_hidden() | |
| 259 | +pub(super) fn card(_palette: Palette) -> Div { | |
| 260 | + div().flex().flex_col() | |
| 277 | 261 | } |
| 278 | 262 | |
| 279 | 263 | pub(super) fn card_header(title: &str, actions: Vec<AnyElement>, palette: Palette) -> Div { |
| 280 | 264 | div() |
| 281 | - .px(px(space::LG)) | |
| 282 | - .py(px(space::MD)) | |
| 265 | + .pb(px(space::XS)) | |
| 283 | 266 | .flex() |
| 284 | 267 | .items_center() |
| 285 | 268 | .justify_between() |
| 286 | 269 | .gap(px(space::SM)) |
| 287 | - .border_b_1() | |
| 288 | - .border_color(palette.border) | |
| 289 | 270 | .child( |
| 290 | 271 | div() |
| 291 | - .text_size(text(text::LABEL)) | |
| 292 | - .font_weight(FontWeight::MEDIUM) | |
| 293 | - .text_color(palette.text) | |
| 272 | + .text_size(text(text::CAPTION)) | |
| 273 | + .text_color(palette.tokens.faint()) | |
| 294 | 274 | .child(title.to_string()), |
| 295 | 275 | ) |
| 296 | 276 | .children(actions) |
| @@ -306,14 +286,7 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palett | ||
| 306 | 286 | .text_color(palette.muted) |
| 307 | 287 | .child(empty.to_string()) |
| 308 | 288 | } else { |
| 309 | - div() | |
| 310 | - .flex() | |
| 311 | - .flex_col() | |
| 312 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 313 | - row.when(index > 0, |row| { | |
| 314 | - row.border_t_1().border_color(palette.border) | |
| 315 | - }) | |
| 316 | - })) | |
| 289 | + div().flex().flex_col().children(rows) | |
| 317 | 290 | }; |
| 318 | 291 | |
| 319 | 292 | card(palette) |
| @@ -324,8 +297,7 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palett | ||
| 324 | 297 | pub(super) fn list_row() -> Div { |
| 325 | 298 | div() |
| 326 | 299 | .min_h(px(size::ROW)) |
| 327 | - .px(px(space::LG)) | |
| 328 | - .py(px(space::MD)) | |
| 300 | + .py(px(space::SM)) | |
| 329 | 301 | .flex() |
| 330 | 302 | .items_center() |
| 331 | 303 | .gap(px(space::MD)) |
| @@ -342,12 +314,10 @@ pub(super) fn toolbar(items: Vec<AnyElement>) -> Div { | ||
| 342 | 314 | |
| 343 | 315 | pub(super) fn stat_tile(label: &str, value: &str, palette: Palette) -> Div { |
| 344 | 316 | card(palette) |
| 345 | - .p(px(space::LG)) | |
| 346 | - .gap(px(space::XS)) | |
| 317 | + .gap(px(space::XXS)) | |
| 347 | 318 | .child( |
| 348 | 319 | div() |
| 349 | - .text_size(text(text::TITLE)) | |
| 350 | - .font_weight(FontWeight::SEMIBOLD) | |
| 320 | + .text_size(text(text::DISPLAY)) | |
| 351 | 321 | .text_color(palette.text) |
| 352 | 322 | .child(value.to_string()), |
| 353 | 323 | ) |
| @@ -390,11 +360,8 @@ pub(super) fn field_row( | ||
| 390 | 360 | } |
| 391 | 361 | |
| 392 | 362 | pub(super) fn pill(label: &str, color: Hsla, palette: Palette) -> Div { |
| 363 | + let _ = palette; | |
| 393 | 364 | div() |
| 394 | - .px(px(space::SM)) | |
| 395 | - .py(px(space::XXS)) | |
| 396 | - .rounded(px(radius::SM)) | |
| 397 | - .bg(palette.hover) | |
| 398 | 365 | .text_size(text(text::CAPTION)) |
| 399 | 366 | .text_color(color) |
| 400 | 367 | .child(label.to_string()) |
crates/client/src/gui/builder/users.rsmodified+8 -17
| @@ -461,14 +461,11 @@ impl Yumush { | ||
| 461 | 461 | }; |
| 462 | 462 | |
| 463 | 463 | let toolbar = div() |
| 464 | - .px(px(space::LG)) | |
| 465 | - .py(px(space::MD)) | |
| 464 | + .pb(px(space::SM)) | |
| 466 | 465 | .flex() |
| 467 | 466 | .flex_wrap() |
| 468 | 467 | .items_center() |
| 469 | 468 | .gap(px(space::SM)) |
| 470 | - .border_b_1() | |
| 471 | - .border_color(palette.border) | |
| 472 | 469 | .child( |
| 473 | 470 | div() |
| 474 | 471 | .flex_1() |
| @@ -505,14 +502,7 @@ impl Yumush { | ||
| 505 | 502 | .text_color(palette.muted) |
| 506 | 503 | .child(w().builder_users.no_users) |
| 507 | 504 | } else { |
| 508 | - div() | |
| 509 | - .flex() | |
| 510 | - .flex_col() | |
| 511 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 512 | - row.when(index > 0, |row| { | |
| 513 | - row.border_t_1().border_color(palette.border) | |
| 514 | - }) | |
| 515 | - })) | |
| 505 | + div().flex().flex_col().children(rows) | |
| 516 | 506 | }; |
| 517 | 507 | |
| 518 | 508 | vec![card(palette).child(toolbar).child(body).into_any_element()] |
| @@ -1076,11 +1066,12 @@ impl Yumush { | ||
| 1076 | 1066 | .flex() |
| 1077 | 1067 | .flex_col() |
| 1078 | 1068 | .gap(px(space::SM)) |
| 1079 | - .px(px(space::LG)) | |
| 1080 | - .py(px(space::MD)) | |
| 1081 | - .bg(palette.window) | |
| 1082 | - .border_t_1() | |
| 1083 | - .border_color(palette.border) | |
| 1069 | + .ml(px(space::MD)) | |
| 1070 | + .mb(px(space::MD)) | |
| 1071 | + .pl(px(space::XL)) | |
| 1072 | + .py(px(space::SM)) | |
| 1073 | + .border_l(px(crate::gui::style::stroke::LINE)) | |
| 1074 | + .border_color(palette.tokens.person(user.id)) | |
| 1084 | 1075 | .children(action_group( |
| 1085 | 1076 | w().builder_users.group_account, |
| 1086 | 1077 | palette, |
crates/client/src/gui/community_settings.rsmodified+20 -28
| @@ -19,9 +19,7 @@ use gpui_kit::{ | ||
| 19 | 19 | input::{Input, InputState}, |
| 20 | 20 | notification::Notification, |
| 21 | 21 | }, |
| 22 | - div, | |
| 23 | - prelude::FluentBuilder as _, | |
| 24 | - px, | |
| 22 | + div, px, | |
| 25 | 23 | }; |
| 26 | 24 | |
| 27 | 25 | use super::{ |
| @@ -30,8 +28,8 @@ use super::{ | ||
| 30 | 28 | clickable, community_icon, entity_action, millis_time, notify_error, |
| 31 | 29 | profile::user_link, |
| 32 | 30 | settings_page::{ |
| 33 | - Editable, Picture, Section, danger_section, delete_control, page, picked_avatar, | |
| 34 | - picture_card, row, section, small_button, text_row, | |
| 31 | + Editable, Picture, Section, delete_control, page, picked_avatar, picture_card, row, | |
| 32 | + section, small_button, text_row, with_danger, | |
| 35 | 33 | }, |
| 36 | 34 | style::{radius, size, space, text as text_token}, |
| 37 | 35 | text, |
| @@ -190,25 +188,24 @@ impl Yumush { | ||
| 190 | 188 | } |
| 191 | 189 | let mut danger = Vec::new(); |
| 192 | 190 | if let Some(community) = community.filter(|_| permission::can_leave(actor)) { |
| 193 | - danger.push(row( | |
| 194 | - w().community_settings.leave_community, | |
| 195 | - leave_control(entity, community.id, palette), | |
| 196 | - )); | |
| 191 | + danger.push(leave_control(entity, community.id, palette).into_any_element()); | |
| 197 | 192 | } |
| 198 | 193 | if permission::can_delete_community(actor) { |
| 199 | - danger.push(row( | |
| 200 | - w().community_settings.delete_community, | |
| 194 | + danger.push( | |
| 201 | 195 | delete_control( |
| 202 | 196 | "delete_community_button", |
| 197 | + w().community_settings.delete_community, | |
| 203 | 198 | self.chat.delete_step, |
| 204 | 199 | entity, |
| 205 | 200 | palette, |
| 206 | 201 | Yumush::delete_community, |
| 207 | - ), | |
| 208 | - )); | |
| 202 | + ) | |
| 203 | + .into_any_element(), | |
| 204 | + ); | |
| 209 | 205 | } |
| 210 | - if !danger.is_empty() { | |
| 211 | - sections.push(danger_section(palette, danger)); | |
| 206 | + if !sections.is_empty() { | |
| 207 | + let first = sections.remove(0); | |
| 208 | + sections.insert(0, with_danger(first, danger)); | |
| 212 | 209 | } |
| 213 | 210 | |
| 214 | 211 | page( |
| @@ -496,8 +493,6 @@ fn voice_control( | ||
| 496 | 493 | }); |
| 497 | 494 | }, |
| 498 | 495 | ) |
| 499 | - .border_1() | |
| 500 | - .border_color(palette.border) | |
| 501 | 496 | .child(if enabled { |
| 502 | 497 | w().community_settings.on |
| 503 | 498 | } else { |
| @@ -512,8 +507,6 @@ fn view_control( | ||
| 512 | 507 | open: fn(&mut Yumush, &mut Window, &mut Context<Yumush>), |
| 513 | 508 | ) -> impl IntoElement { |
| 514 | 509 | small_button(id, palette, palette.text, entity_action(entity, open)) |
| 515 | - .border_1() | |
| 516 | - .border_color(palette.border) | |
| 517 | 510 | .child(w().community_settings.view) |
| 518 | 511 | } |
| 519 | 512 | |
| @@ -528,11 +521,7 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>( | ||
| 528 | 521 | .h(px(size::CONTROL_SM)) |
| 529 | 522 | .p(px(space::XXS)) |
| 530 | 523 | .flex() |
| 531 | - .gap(px(space::XXS)) | |
| 532 | - .rounded(px(radius::MD)) | |
| 533 | - .border_1() | |
| 534 | - .border_color(palette.border) | |
| 535 | - .bg(palette.field) | |
| 524 | + .gap(px(space::MD)) | |
| 536 | 525 | .children(options.map(|(choice, id, label)| { |
| 537 | 526 | let active = choice == selected; |
| 538 | 527 | |
| @@ -549,7 +538,12 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>( | ||
| 549 | 538 | .rounded(px(radius::SM)) |
| 550 | 539 | .text_size(text(text_token::CAPTION)) |
| 551 | 540 | .text_color(if active { palette.text } else { palette.muted }) |
| 552 | - .when(active, |this| this.bg(palette.hover)) | |
| 541 | + .border_b(px(super::style::stroke::LINE)) | |
| 542 | + .border_color(if active { | |
| 543 | + palette.tokens.paper() | |
| 544 | + } else { | |
| 545 | + gpui_kit::transparent_black() | |
| 546 | + }) | |
| 553 | 547 | .child(label) |
| 554 | 548 | })) |
| 555 | 549 | } |
| @@ -693,9 +687,7 @@ fn leave_control(entity: &Entity<Yumush>, community_id: Id, palette: Palette) -> | ||
| 693 | 687 | }); |
| 694 | 688 | }, |
| 695 | 689 | ) |
| 696 | - .border_1() | |
| 697 | - .border_color(palette.border) | |
| 698 | - .child(w().community_settings.leave) | |
| 690 | + .child(w().community_settings.leave_community) | |
| 699 | 691 | } |
| 700 | 692 | |
| 701 | 693 | fn ban_row( |
crates/client/src/gui/settings_page.rsmodified+143 -150
| @@ -10,19 +10,15 @@ use common::{ | ||
| 10 | 10 | use gpui_kit::{ |
| 11 | 11 | AnyElement, App, AsyncWindowContext, Context, Div, Entity, FontWeight, Hsla, |
| 12 | 12 | InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful, |
| 13 | - StatefulInteractiveElement, Styled, WeakEntity, Window, | |
| 14 | - assets::IconName, | |
| 15 | - component::{Icon, input::InputState}, | |
| 16 | - div, | |
| 17 | - prelude::FluentBuilder as _, | |
| 18 | - px, transparent_black, | |
| 13 | + StatefulInteractiveElement, Styled, WeakEntity, Window, component::input::InputState, div, | |
| 14 | + prelude::FluentBuilder as _, px, transparent_black, | |
| 19 | 15 | }; |
| 20 | 16 | |
| 21 | 17 | use super::{ |
| 22 | 18 | Palette, Tooltip as _, Yumush, avatar, |
| 23 | 19 | chat::DeleteStep, |
| 24 | 20 | chat::View, |
| 25 | - clickable, notify_error, parts, primary_button, | |
| 21 | + clickable, notify_error, parts, | |
| 26 | 22 | share_view::{AudioMode, FPS, RESOLUTIONS, codecs, share_modes}, |
| 27 | 23 | text, |
| 28 | 24 | widget::field, |
| @@ -50,7 +46,6 @@ impl Yumush { | ||
| 50 | 46 | let mut sections = Vec::new(); |
| 51 | 47 | if let Some(user) = self.user.as_ref() { |
| 52 | 48 | let presence_entity = entity.clone(); |
| 53 | - let logout_entity = entity.clone(); | |
| 54 | 49 | sections.push(Section( |
| 55 | 50 | settings_titles()[0], |
| 56 | 51 | div() |
| @@ -123,26 +118,6 @@ impl Yumush { | ||
| 123 | 118 | ], |
| 124 | 119 | ), |
| 125 | 120 | )) |
| 126 | - .child(titled( | |
| 127 | - w().settings_page.account, | |
| 128 | - palette, | |
| 129 | - rows_column( | |
| 130 | - palette, | |
| 131 | - vec![row( | |
| 132 | - w().settings_page.log_out, | |
| 133 | - small_button( | |
| 134 | - "logout_button", | |
| 135 | - palette, | |
| 136 | - palette.danger, | |
| 137 | - move |window, cx| { | |
| 138 | - logout_entity | |
| 139 | - .update(cx, |yumush, cx| yumush.logout(window, cx)) | |
| 140 | - }, | |
| 141 | - ) | |
| 142 | - .child(w().settings_page.log_out), | |
| 143 | - )], | |
| 144 | - ), | |
| 145 | - )) | |
| 146 | 121 | .into_any_element(), |
| 147 | 122 | )); |
| 148 | 123 | } |
| @@ -211,20 +186,33 @@ impl Yumush { | ||
| 211 | 186 | )); |
| 212 | 187 | } |
| 213 | 188 | sections.push(section(settings_titles()[3], palette, appearance)); |
| 214 | - if self.user.is_some() { | |
| 215 | - sections.push(danger_section( | |
| 216 | - palette, | |
| 217 | - vec![row( | |
| 218 | - w().settings_page.delete_account, | |
| 219 | - delete_control( | |
| 220 | - "delete_account_button", | |
| 221 | - self.chat.delete_step, | |
| 222 | - entity, | |
| 223 | - palette, | |
| 224 | - Yumush::delete_account, | |
| 225 | - ), | |
| 226 | - )], | |
| 227 | - )); | |
| 189 | + if self.user.is_some() && !sections.is_empty() { | |
| 190 | + let profile = sections.remove(0); | |
| 191 | + sections.insert( | |
| 192 | + 0, | |
| 193 | + with_danger( | |
| 194 | + profile, | |
| 195 | + vec![ | |
| 196 | + small_button("logout_button", palette, palette.muted, { | |
| 197 | + let entity = entity.clone(); | |
| 198 | + move |window, cx| { | |
| 199 | + entity.update(cx, |yumush, cx| yumush.logout(window, cx)) | |
| 200 | + } | |
| 201 | + }) | |
| 202 | + .child(w().settings_page.log_out) | |
| 203 | + .into_any_element(), | |
| 204 | + delete_control( | |
| 205 | + "delete_account_button", | |
| 206 | + w().settings_page.delete_account, | |
| 207 | + self.chat.delete_step, | |
| 208 | + entity, | |
| 209 | + palette, | |
| 210 | + Yumush::delete_account, | |
| 211 | + ) | |
| 212 | + .into_any_element(), | |
| 213 | + ], | |
| 214 | + ), | |
| 215 | + ); | |
| 228 | 216 | } |
| 229 | 217 | |
| 230 | 218 | page( |
| @@ -562,35 +550,6 @@ pub(super) fn picked_avatar( | ||
| 562 | 550 | } |
| 563 | 551 | } |
| 564 | 552 | |
| 565 | -pub(super) fn header( | |
| 566 | - entity: &Entity<Yumush>, | |
| 567 | - palette: Palette, | |
| 568 | - title: impl IntoElement, | |
| 569 | -) -> impl IntoElement { | |
| 570 | - let entity = entity.clone(); | |
| 571 | - | |
| 572 | - div() | |
| 573 | - .h(px(size::ROW)) | |
| 574 | - .px(px(space::LG)) | |
| 575 | - .flex() | |
| 576 | - .items_center() | |
| 577 | - .child( | |
| 578 | - clickable("settings_back_button", palette, move |window, cx| { | |
| 579 | - entity.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx)); | |
| 580 | - }) | |
| 581 | - .tip(w().settings_page.back) | |
| 582 | - .h(px(size::CONTROL_SM)) | |
| 583 | - .px(px(space::SM)) | |
| 584 | - .rounded(px(radius::MD)) | |
| 585 | - .flex() | |
| 586 | - .items_center() | |
| 587 | - .gap(px(space::XS)) | |
| 588 | - .font_weight(FontWeight::MEDIUM) | |
| 589 | - .child(Icon::new(IconName::ChevronLeft).size(px(size::ICON_SM))) | |
| 590 | - .child(title), | |
| 591 | - ) | |
| 592 | -} | |
| 593 | - | |
| 594 | 553 | pub(super) struct Section(pub &'static str, pub AnyElement); |
| 595 | 554 | |
| 596 | 555 | pub(super) fn page( |
| @@ -619,6 +578,7 @@ pub(super) fn page( | ||
| 619 | 578 | }) |
| 620 | 579 | }, |
| 621 | 580 | ) |
| 581 | + .into_any_element() | |
| 622 | 582 | }) |
| 623 | 583 | .collect(); |
| 624 | 584 | let body = sections |
| @@ -626,42 +586,80 @@ pub(super) fn page( | ||
| 626 | 586 | .nth(selected) |
| 627 | 587 | .map(|Section(_, body)| body); |
| 628 | 588 | |
| 589 | + frame( | |
| 590 | + id, | |
| 591 | + entity, | |
| 592 | + palette, | |
| 593 | + title, | |
| 594 | + index, | |
| 595 | + Vec::new(), | |
| 596 | + body.into_iter().collect(), | |
| 597 | + ) | |
| 598 | +} | |
| 599 | + | |
| 600 | +pub(super) fn frame( | |
| 601 | + id: &'static str, | |
| 602 | + entity: &Entity<Yumush>, | |
| 603 | + palette: Palette, | |
| 604 | + title: impl IntoElement, | |
| 605 | + index: Vec<AnyElement>, | |
| 606 | + footer: Vec<AnyElement>, | |
| 607 | + body: Vec<AnyElement>, | |
| 608 | +) -> Div { | |
| 609 | + let back = entity.clone(); | |
| 610 | + | |
| 629 | 611 | div() |
| 630 | 612 | .flex_1() |
| 613 | + .min_w_0() | |
| 631 | 614 | .min_h_0() |
| 632 | 615 | .flex() |
| 633 | - .flex_col() | |
| 634 | - .child(header(entity, palette, title)) | |
| 635 | 616 | .child( |
| 636 | 617 | div() |
| 637 | - .flex_1() | |
| 638 | - .min_h_0() | |
| 618 | + .w(px(size::SIDEBAR)) | |
| 619 | + .flex_shrink_0() | |
| 620 | + .px(px(space::XL)) | |
| 621 | + .py(px(space::XL)) | |
| 639 | 622 | .flex() |
| 623 | + .flex_col() | |
| 624 | + .border_r(px(stroke::LINE)) | |
| 625 | + .border_color(palette.tokens.thread()) | |
| 640 | 626 | .child( |
| 641 | 627 | div() |
| 642 | - .w(px(size::SIDEBAR)) | |
| 643 | - .flex_shrink_0() | |
| 644 | - .px(px(space::XL)) | |
| 645 | - .py(px(space::LG)) | |
| 646 | - .flex() | |
| 647 | - .flex_col() | |
| 648 | - .children(index), | |
| 628 | + .pb(px(space::XL)) | |
| 629 | + .text_size(text(text::TITLE)) | |
| 630 | + .text_color(palette.tokens.paper()) | |
| 631 | + .child(title), | |
| 649 | 632 | ) |
| 633 | + .children(index) | |
| 634 | + .child(div().flex_1()) | |
| 635 | + .children(footer) | |
| 636 | + .child( | |
| 637 | + clickable("page_back", palette, move |window, cx| { | |
| 638 | + back.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx)); | |
| 639 | + }) | |
| 640 | + .pt(px(space::MD)) | |
| 641 | + .text_size(text(text::CAPTION)) | |
| 642 | + .text_color(palette.tokens.faint()) | |
| 643 | + .child(w().settings_page.back_esc), | |
| 644 | + ), | |
| 645 | + ) | |
| 646 | + .child( | |
| 647 | + div() | |
| 648 | + .id(id) | |
| 649 | + .flex_1() | |
| 650 | + .min_w_0() | |
| 651 | + .min_h_0() | |
| 652 | + .overflow_y_scroll() | |
| 650 | 653 | .child( |
| 651 | 654 | div() |
| 652 | - .id(id) | |
| 653 | - .flex_1() | |
| 654 | - .min_w_0() | |
| 655 | - .min_h_0() | |
| 656 | - .overflow_y_scroll() | |
| 657 | - .child( | |
| 658 | - div() | |
| 659 | - .w_full() | |
| 660 | - .max_w(px(size::PAGE)) | |
| 661 | - .px(px(space::XL)) | |
| 662 | - .py(px(space::LG)) | |
| 663 | - .children(body), | |
| 664 | - ), | |
| 655 | + .w_full() | |
| 656 | + .max_w(px(size::PAGE)) | |
| 657 | + .px(px(space::XXL)) | |
| 658 | + .py(px(space::XL)) | |
| 659 | + .flex() | |
| 660 | + .flex_col() | |
| 661 | + .gap(px(space::XL)) | |
| 662 | + .children(body), | |
| 665 | 663 | ), |
| 666 | 664 | ) |
| 667 | 665 | } |
| @@ -670,8 +668,26 @@ pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) -> | ||
| 670 | 668 | Section(title, rows_column(palette, rows)) |
| 671 | 669 | } |
| 672 | 670 | |
| 673 | -pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> Section { | |
| 674 | - Section(w().settings_page.danger_zone, rows_column(palette, rows)) | |
| 671 | +pub(super) fn with_danger(section: Section, actions: Vec<AnyElement>) -> Section { | |
| 672 | + let Section(title, body) = section; | |
| 673 | + Section( | |
| 674 | + title, | |
| 675 | + div() | |
| 676 | + .flex() | |
| 677 | + .flex_col() | |
| 678 | + .gap(px(space::XXL)) | |
| 679 | + .child(body) | |
| 680 | + .when(!actions.is_empty(), |this| { | |
| 681 | + this.child( | |
| 682 | + div() | |
| 683 | + .flex() | |
| 684 | + .items_center() | |
| 685 | + .gap(px(space::LG)) | |
| 686 | + .children(actions), | |
| 687 | + ) | |
| 688 | + }) | |
| 689 | + .into_any_element(), | |
| 690 | + ) | |
| 675 | 691 | } |
| 676 | 692 | |
| 677 | 693 | 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 | ||
| 682 | 698 | .child(rows) |
| 683 | 699 | } |
| 684 | 700 | |
| 685 | -fn rows_column(palette: Palette, rows: Vec<Div>) -> AnyElement { | |
| 686 | - div() | |
| 687 | - .flex() | |
| 688 | - .flex_col() | |
| 689 | - .children(rows.into_iter().enumerate().map(|(index, row)| { | |
| 690 | - row.when(index > 0, |row| { | |
| 691 | - row.border_t_1().border_color(palette.border) | |
| 692 | - }) | |
| 693 | - })) | |
| 694 | - .into_any_element() | |
| 701 | +fn rows_column(_palette: Palette, rows: Vec<Div>) -> AnyElement { | |
| 702 | + div().flex().flex_col().children(rows).into_any_element() | |
| 695 | 703 | } |
| 696 | 704 | |
| 697 | 705 | pub(super) struct Editable<'a> { |
| @@ -713,34 +721,32 @@ pub(super) fn text_row( | ||
| 713 | 721 | let save = editable.save; |
| 714 | 722 | |
| 715 | 723 | div() |
| 716 | - .p(px(space::MD)) | |
| 724 | + .min_h(px(size::ROW)) | |
| 725 | + .py(px(space::SM)) | |
| 717 | 726 | .flex() |
| 718 | - .flex_col() | |
| 719 | - .gap(px(space::SM)) | |
| 720 | - .child( | |
| 721 | - div() | |
| 722 | - .text_size(text(text::CAPTION)) | |
| 723 | - .text_color(palette.muted) | |
| 724 | - .child(editable.label), | |
| 725 | - ) | |
| 727 | + .items_center() | |
| 728 | + .justify_between() | |
| 729 | + .gap(px(space::XL)) | |
| 730 | + .child(editable.label) | |
| 726 | 731 | .child( |
| 727 | 732 | div() |
| 733 | + .w(px(size::SIDEBAR)) | |
| 734 | + .flex_shrink_0() | |
| 728 | 735 | .flex() |
| 729 | 736 | .items_center() |
| 730 | 737 | .gap(px(space::SM)) |
| 731 | 738 | .child(field(palette, editable.input).flex_1()) |
| 732 | 739 | .when(dirty, |this| { |
| 733 | 740 | this.child( |
| 734 | - primary_button(editable.id, palette, move |window, cx| { | |
| 741 | + clickable(editable.id, palette, move |window, cx| { | |
| 735 | 742 | entity.update(cx, |yumush, cx| save(yumush, window, cx)); |
| 736 | 743 | }) |
| 737 | - .h(px(size::CONTROL)) | |
| 738 | - .px(px(space::LG)) | |
| 739 | - .flex() | |
| 740 | - .items_center() | |
| 741 | - .rounded(px(radius::MD)) | |
| 742 | - .font_weight(FontWeight::MEDIUM) | |
| 743 | - .child(w().settings_page.save), | |
| 744 | + .tip(w().settings_page.save) | |
| 745 | + .px(px(space::XS)) | |
| 746 | + .rounded(px(radius::SM)) | |
| 747 | + .text_size(text(text::CAPTION)) | |
| 748 | + .text_color(palette.tokens.paper()) | |
| 749 | + .child("↵"), | |
| 744 | 750 | ) |
| 745 | 751 | }), |
| 746 | 752 | ) |
| @@ -832,16 +838,17 @@ pub(super) fn small_button( | ||
| 832 | 838 | ) -> Stateful<Div> { |
| 833 | 839 | clickable(id, palette, on_click) |
| 834 | 840 | .h(px(size::CONTROL_SM)) |
| 835 | - .px(px(space::MD)) | |
| 841 | + .px(px(space::SM)) | |
| 836 | 842 | .flex() |
| 837 | 843 | .items_center() |
| 838 | 844 | .rounded(px(radius::MD)) |
| 839 | - .text_size(text(text::LABEL)) | |
| 845 | + .text_size(text(text::UI)) | |
| 840 | 846 | .text_color(color) |
| 841 | 847 | } |
| 842 | 848 | |
| 843 | 849 | pub(super) fn delete_control( |
| 844 | 850 | id: &'static str, |
| 851 | + label: &'static str, | |
| 845 | 852 | step: DeleteStep, |
| 846 | 853 | entity: &Entity<Yumush>, |
| 847 | 854 | palette: Palette, |
| @@ -853,23 +860,19 @@ pub(super) fn delete_control( | ||
| 853 | 860 | small_button(id, palette, palette.danger, move |window, cx| { |
| 854 | 861 | entity.update(cx, |yumush, cx| action(yumush, window, cx)); |
| 855 | 862 | }) |
| 856 | - .border_1() | |
| 857 | - .border_color(palette.border) | |
| 858 | - .when(confirming, |this| { | |
| 859 | - this.bg(palette.danger).text_color(palette.on_accent) | |
| 860 | - }) | |
| 863 | + .when(confirming, |this| this.font_weight(FontWeight::MEDIUM)) | |
| 861 | 864 | .child(if confirming { |
| 862 | 865 | w().settings_page.confirm |
| 863 | 866 | } else { |
| 864 | - w().settings_page.delete | |
| 867 | + label | |
| 865 | 868 | }) |
| 866 | 869 | } |
| 867 | 870 | |
| 868 | 871 | pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div { |
| 869 | 872 | div() |
| 870 | 873 | .min_h(px(size::ROW)) |
| 871 | - .py(px(space::MD)) | |
| 872 | - .px(px(space::MD)) | |
| 874 | + .py(px(space::SM)) | |
| 875 | + .gap(px(space::XL)) | |
| 873 | 876 | .flex() |
| 874 | 877 | .items_center() |
| 875 | 878 | .justify_between() |
| @@ -877,32 +880,22 @@ pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div { | ||
| 877 | 880 | .child(control) |
| 878 | 881 | } |
| 879 | 882 | |
| 880 | -pub(super) fn segment_track(palette: Palette) -> Div { | |
| 881 | - div() | |
| 882 | - .h(px(size::CONTROL)) | |
| 883 | - .p(px(space::XXS)) | |
| 884 | - .flex() | |
| 885 | - .gap(px(space::XXS)) | |
| 886 | - .rounded(px(radius::MD)) | |
| 887 | - .border_1() | |
| 888 | - .border_color(palette.border) | |
| 889 | - .bg(palette.window) | |
| 883 | +pub(super) fn segment_track(_palette: Palette) -> Div { | |
| 884 | + div().h(px(size::CONTROL)).flex().gap(px(space::LG)) | |
| 890 | 885 | } |
| 891 | 886 | |
| 892 | 887 | pub(super) fn segment<E: Styled>(item: E, active: bool, palette: Palette) -> E { |
| 893 | - let (background, border, text) = if active { | |
| 894 | - (palette.field, palette.border, palette.text) | |
| 888 | + let (border, text) = if active { | |
| 889 | + (palette.tokens.paper(), palette.tokens.paper()) | |
| 895 | 890 | } else { |
| 896 | - (transparent_black(), transparent_black(), palette.muted) | |
| 891 | + (transparent_black(), palette.muted) | |
| 897 | 892 | }; |
| 898 | 893 | |
| 899 | 894 | item.flex() |
| 900 | 895 | .items_center() |
| 901 | 896 | .justify_center() |
| 902 | - .rounded(px(radius::SM)) | |
| 903 | - .border_1() | |
| 897 | + .border_b(px(stroke::LINE)) | |
| 904 | 898 | .border_color(border) |
| 905 | - .bg(background) | |
| 906 | 899 | .text_color(text) |
| 907 | 900 | } |
| 908 | 901 |