forge
Explore
Log in

Don't you dare go Hollow

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 commit

9f9d7190cf13f931b8e64cbf267ec598205cbf06Ahmet Kaan GümüşParent: d045bcc
  • style
    • full pages share one frame: titled index with an ink thread, esc back link, one column, no cards or row borders
Show full message
💄 style: full pages share one frame: titled index with an ink thread, esc back link, one column, no cards or row borders

Settings, Community settings and Builder use settings_page::frame. Rows are label + control on the ground; text rows edit inline with a ↵ save; options and segments are underlined; danger and log out sit as plain text at the bottom of the first section. Builder cards, headers, pills and buttons lose their panels; an expanded user opens on a thread in their hue; open reports count in coral.
crates/client/lang/en/community_settings.txtmodified+0 -1
@@ -12,7 +12,6 @@ oldest = Oldest
1212 on = On
1313 off = Off
1414 view = View
15-leave = Leave
1615 unban = Unban
1716 no_bans = No bans
1817 no_logs = No logs
crates/client/lang/en/settings_page.txtmodified+1 -4
@@ -3,16 +3,12 @@ voice = Voice
33 camera_share = Camera & share
44 appearance = Appearance
55 title = Settings
6-back = Back
76 identity = Identity
87 name = Name
98 status = Status
109 presence = Presence
11-account = Account
1210 log_out = Log out
1311 delete_account = Delete account
14-danger_zone = Danger zone
15-delete = Delete
1612 confirm = Confirm
1713 save = Save
1814 remove = Remove
@@ -28,3 +24,4 @@ quality = Quality
2824 frame_rate = Frame rate
2925 codec = Codec
3026 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
1212 on = Açık
1313 off = Kapalı
1414 view = Görüntüle
15-leave = Ayrıl
1615 unban = Yasağı kaldır
1716 no_bans = Yasak yok
1817 no_logs = Kayıt yok
crates/client/lang/tr/settings_page.txtmodified+1 -4
@@ -3,16 +3,12 @@ voice = Ses
33 camera_share = Kamera ve paylaşım
44 appearance = Görünüm
55 title = Ayarlar
6-back = Geri
76 identity = Kimlik
87 name = Ad
98 status = Durum
109 presence = Görünürlük
11-account = Hesap
1210 log_out = Çıkış yap
1311 delete_account = Hesabı sil
14-danger_zone = Tehlikeli bölge
15-delete = Sil
1612 confirm = Onayla
1713 save = Kaydet
1814 remove = Kaldır
@@ -28,3 +24,4 @@ quality = Kalite
2824 frame_rate = Kare hızı
2925 codec = Kodek
3026 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::{
2121 permission,
2222 };
2323 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,
2730 };
2831
2932 use self::ui::{accent_button, icon_button, page_heading, plain_button};
@@ -31,7 +34,7 @@ use super::{
3134 Palette, Yumush,
3235 chat::View,
3336 clickable, entity_action, notify_error,
34- settings_page::header,
37+ settings_page::frame,
3538 style::{size, space, text},
3639 text,
3740 widget::search_text,
@@ -139,40 +142,30 @@ impl Yumush {
139142 ];
140143 sections.extend(body);
141144
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+ )
176169 }
177170
178171 fn tab_actions(
@@ -222,20 +215,6 @@ impl Yumush {
222215 }
223216 }
224217
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-
239218 fn builder_nav_item(
240219 &self,
241220 tab: BuilderTab,
@@ -256,7 +235,7 @@ impl Yumush {
256235 yumush.select_builder_tab(tab, window, cx)
257236 }),
258237 )
259- .h(px(size::CONTROL))
238+ .h(px(size::CONTROL_SM + space::XS))
260239 .flex()
261240 .items_center()
262241 .gap(px(space::SM))
@@ -266,7 +245,7 @@ impl Yumush {
266245 .children(open.map(|count| {
267246 div()
268247 .text_size(text(text::CAPTION))
269- .text_color(palette.text)
248+ .text_color(palette.danger)
270249 .child(count.to_string())
271250 }))
272251 }
@@ -279,7 +258,6 @@ impl Yumush {
279258
280259 div()
281260 .h(px(size::CONTROL))
282- .px(px(space::MD))
283261 .flex()
284262 .items_center()
285263 .justify_between()
crates/client/src/gui/builder/access.rsmodified+2 -9
@@ -5,7 +5,7 @@ use common::{
55 };
66 use gpui_kit::{
77 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,
99 };
1010
1111 use super::ui::{
@@ -26,14 +26,7 @@ fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div
2626 .text_color(palette.muted)
2727 .child(empty.to_string())
2828 } 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)
3730 };
3831
3932 card(palette).child(header).child(body)
crates/client/src/gui/builder/backups.rsmodified+2 -9
@@ -4,7 +4,7 @@ use common::{
44 };
55 use gpui_kit::{
66 Context, Div, Entity, IntoElement, ParentElement, Styled, Window, assets::IconName,
7- component::Icon, div, prelude::FluentBuilder as _, px,
7+ component::Icon, div, px,
88 };
99
1010 use super::{
@@ -108,14 +108,7 @@ impl Yumush {
108108 .text_color(palette.muted)
109109 .child(w().builder_backups.no_backups)
110110 } 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)
119112 };
120113
121114 card(palette)
crates/client/src/gui/builder/communities.rsmodified+5 -12
@@ -297,18 +297,11 @@ impl Yumush {
297297 vec![
298298 card(palette)
299299 .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+ ),
312305 )
313306 .child(rows_body(rows, w().builder_communities.empty, palette))
314307 .into_any_element(),
crates/client/src/gui/builder/log.rsmodified+3 -17
@@ -7,9 +7,7 @@ use gpui_kit::{
77 AnyElement, Context, Div, Entity, IntoElement, ParentElement, Styled, Window,
88 assets::IconName,
99 component::{Icon, WindowExt, notification::Notification, select::Select},
10- div,
11- prelude::FluentBuilder as _,
12- px,
10+ div, px,
1311 };
1412 use jiff::Timestamp;
1513
@@ -296,12 +294,7 @@ impl Yumush {
296294 .chat
297295 .builder_logs
298296 .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))
305298 .collect();
306299 let body = if rows.is_empty() {
307300 div()
@@ -317,14 +310,7 @@ impl Yumush {
317310
318311 vec![
319312 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))
328314 .child(body)
329315 .into_any_element(),
330316 ]
crates/client/src/gui/builder/storage.rsmodified+2 -11
@@ -7,9 +7,7 @@ use gpui_kit::{
77 AnyElement, Context, Div, Entity, FontWeight, IntoElement, ParentElement, Styled, Window,
88 assets::IconName,
99 component::{Icon, WindowExt, notification::Notification},
10- div,
11- prelude::FluentBuilder as _,
12- px, relative,
10+ div, px, relative,
1311 };
1412
1513 use super::ui::{
@@ -260,14 +258,7 @@ impl Yumush {
260258 .text_color(palette.muted)
261259 .child(w().builder_storage.no_attachments)
262260 } 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)
271262 };
272263 let attachments = card(palette)
273264 .child(card_header(
crates/client/src/gui/builder/ui.rsmodified+18 -51
@@ -1,5 +1,5 @@
11 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};
33 use crate::lang::w;
44 use gpui_kit::{
55 AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window,
@@ -124,9 +124,7 @@ pub(super) fn confirm_button(
124124 palette,
125125 action,
126126 )
127- .when(pending, |this| {
128- this.bg(palette.danger).text_color(palette.on_accent)
129- })
127+ .when(pending, |this| this.font_weight(FontWeight::SEMIBOLD))
130128 }
131129
132130 pub(super) fn action_group(
@@ -185,10 +183,7 @@ pub(super) fn danger_button(
185183 .flex()
186184 .items_center()
187185 .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))
192187 .text_color(palette.danger)
193188 .child(label)
194189 }
@@ -222,14 +217,7 @@ pub(super) fn rows_body(rows: Vec<Div>, empty: &str, palette: Palette) -> Div {
222217 .text_color(palette.muted)
223218 .child(empty.to_string());
224219 }
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)
233221 }
234222
235223 pub(super) fn accent_button(
@@ -238,14 +226,15 @@ pub(super) fn accent_button(
238226 palette: Palette,
239227 action: impl Fn(&mut Window, &mut App) + 'static,
240228 ) -> impl IntoElement {
241- primary_button(id, palette, action)
229+ clickable(id, palette, action)
242230 .h(px(size::CONTROL_SM))
243- .px(px(space::MD))
231+ .px(px(space::SM))
244232 .flex()
245233 .items_center()
246234 .rounded(px(radius::MD))
247- .text_size(text(text::CAPTION))
235+ .text_size(text(text::UI))
248236 .font_weight(FontWeight::MEDIUM)
237+ .text_color(palette.tokens.paper())
249238 .child(label)
250239 }
251240
@@ -267,30 +256,21 @@ pub(super) fn plain_button(
267256 .child(label)
268257 }
269258
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()
277261 }
278262
279263 pub(super) fn card_header(title: &str, actions: Vec<AnyElement>, palette: Palette) -> Div {
280264 div()
281- .px(px(space::LG))
282- .py(px(space::MD))
265+ .pb(px(space::XS))
283266 .flex()
284267 .items_center()
285268 .justify_between()
286269 .gap(px(space::SM))
287- .border_b_1()
288- .border_color(palette.border)
289270 .child(
290271 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())
294274 .child(title.to_string()),
295275 )
296276 .children(actions)
@@ -306,14 +286,7 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palett
306286 .text_color(palette.muted)
307287 .child(empty.to_string())
308288 } 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)
317290 };
318291
319292 card(palette)
@@ -324,8 +297,7 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palett
324297 pub(super) fn list_row() -> Div {
325298 div()
326299 .min_h(px(size::ROW))
327- .px(px(space::LG))
328- .py(px(space::MD))
300+ .py(px(space::SM))
329301 .flex()
330302 .items_center()
331303 .gap(px(space::MD))
@@ -342,12 +314,10 @@ pub(super) fn toolbar(items: Vec<AnyElement>) -> Div {
342314
343315 pub(super) fn stat_tile(label: &str, value: &str, palette: Palette) -> Div {
344316 card(palette)
345- .p(px(space::LG))
346- .gap(px(space::XS))
317+ .gap(px(space::XXS))
347318 .child(
348319 div()
349- .text_size(text(text::TITLE))
350- .font_weight(FontWeight::SEMIBOLD)
320+ .text_size(text(text::DISPLAY))
351321 .text_color(palette.text)
352322 .child(value.to_string()),
353323 )
@@ -390,11 +360,8 @@ pub(super) fn field_row(
390360 }
391361
392362 pub(super) fn pill(label: &str, color: Hsla, palette: Palette) -> Div {
363+ let _ = palette;
393364 div()
394- .px(px(space::SM))
395- .py(px(space::XXS))
396- .rounded(px(radius::SM))
397- .bg(palette.hover)
398365 .text_size(text(text::CAPTION))
399366 .text_color(color)
400367 .child(label.to_string())
crates/client/src/gui/builder/users.rsmodified+8 -17
@@ -461,14 +461,11 @@ impl Yumush {
461461 };
462462
463463 let toolbar = div()
464- .px(px(space::LG))
465- .py(px(space::MD))
464+ .pb(px(space::SM))
466465 .flex()
467466 .flex_wrap()
468467 .items_center()
469468 .gap(px(space::SM))
470- .border_b_1()
471- .border_color(palette.border)
472469 .child(
473470 div()
474471 .flex_1()
@@ -505,14 +502,7 @@ impl Yumush {
505502 .text_color(palette.muted)
506503 .child(w().builder_users.no_users)
507504 } 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)
516506 };
517507
518508 vec![card(palette).child(toolbar).child(body).into_any_element()]
@@ -1076,11 +1066,12 @@ impl Yumush {
10761066 .flex()
10771067 .flex_col()
10781068 .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))
10841075 .children(action_group(
10851076 w().builder_users.group_account,
10861077 palette,
crates/client/src/gui/community_settings.rsmodified+20 -28
@@ -19,9 +19,7 @@ use gpui_kit::{
1919 input::{Input, InputState},
2020 notification::Notification,
2121 },
22- div,
23- prelude::FluentBuilder as _,
24- px,
22+ div, px,
2523 };
2624
2725 use super::{
@@ -30,8 +28,8 @@ use super::{
3028 clickable, community_icon, entity_action, millis_time, notify_error,
3129 profile::user_link,
3230 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,
3533 },
3634 style::{radius, size, space, text as text_token},
3735 text,
@@ -190,25 +188,24 @@ impl Yumush {
190188 }
191189 let mut danger = Vec::new();
192190 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());
197192 }
198193 if permission::can_delete_community(actor) {
199- danger.push(row(
200- w().community_settings.delete_community,
194+ danger.push(
201195 delete_control(
202196 "delete_community_button",
197+ w().community_settings.delete_community,
203198 self.chat.delete_step,
204199 entity,
205200 palette,
206201 Yumush::delete_community,
207- ),
208- ));
202+ )
203+ .into_any_element(),
204+ );
209205 }
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));
212209 }
213210
214211 page(
@@ -496,8 +493,6 @@ fn voice_control(
496493 });
497494 },
498495 )
499- .border_1()
500- .border_color(palette.border)
501496 .child(if enabled {
502497 w().community_settings.on
503498 } else {
@@ -512,8 +507,6 @@ fn view_control(
512507 open: fn(&mut Yumush, &mut Window, &mut Context<Yumush>),
513508 ) -> impl IntoElement {
514509 small_button(id, palette, palette.text, entity_action(entity, open))
515- .border_1()
516- .border_color(palette.border)
517510 .child(w().community_settings.view)
518511 }
519512
@@ -528,11 +521,7 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(
528521 .h(px(size::CONTROL_SM))
529522 .p(px(space::XXS))
530523 .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))
536525 .children(options.map(|(choice, id, label)| {
537526 let active = choice == selected;
538527
@@ -549,7 +538,12 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(
549538 .rounded(px(radius::SM))
550539 .text_size(text(text_token::CAPTION))
551540 .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+ })
553547 .child(label)
554548 }))
555549 }
@@ -693,9 +687,7 @@ fn leave_control(entity: &Entity<Yumush>, community_id: Id, palette: Palette) ->
693687 });
694688 },
695689 )
696- .border_1()
697- .border_color(palette.border)
698- .child(w().community_settings.leave)
690+ .child(w().community_settings.leave_community)
699691 }
700692
701693 fn ban_row(
crates/client/src/gui/settings_page.rsmodified+143 -150
@@ -10,19 +10,15 @@ use common::{
1010 use gpui_kit::{
1111 AnyElement, App, AsyncWindowContext, Context, Div, Entity, FontWeight, Hsla,
1212 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,
1915 };
2016
2117 use super::{
2218 Palette, Tooltip as _, Yumush, avatar,
2319 chat::DeleteStep,
2420 chat::View,
25- clickable, notify_error, parts, primary_button,
21+ clickable, notify_error, parts,
2622 share_view::{AudioMode, FPS, RESOLUTIONS, codecs, share_modes},
2723 text,
2824 widget::field,
@@ -50,7 +46,6 @@ impl Yumush {
5046 let mut sections = Vec::new();
5147 if let Some(user) = self.user.as_ref() {
5248 let presence_entity = entity.clone();
53- let logout_entity = entity.clone();
5449 sections.push(Section(
5550 settings_titles()[0],
5651 div()
@@ -123,26 +118,6 @@ impl Yumush {
123118 ],
124119 ),
125120 ))
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- ))
146121 .into_any_element(),
147122 ));
148123 }
@@ -211,20 +186,33 @@ impl Yumush {
211186 ));
212187 }
213188 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+ );
228216 }
229217
230218 page(
@@ -562,35 +550,6 @@ pub(super) fn picked_avatar(
562550 }
563551 }
564552
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-
594553 pub(super) struct Section(pub &'static str, pub AnyElement);
595554
596555 pub(super) fn page(
@@ -619,6 +578,7 @@ pub(super) fn page(
619578 })
620579 },
621580 )
581+ .into_any_element()
622582 })
623583 .collect();
624584 let body = sections
@@ -626,42 +586,80 @@ pub(super) fn page(
626586 .nth(selected)
627587 .map(|Section(_, body)| body);
628588
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+
629611 div()
630612 .flex_1()
613+ .min_w_0()
631614 .min_h_0()
632615 .flex()
633- .flex_col()
634- .child(header(entity, palette, title))
635616 .child(
636617 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))
639622 .flex()
623+ .flex_col()
624+ .border_r(px(stroke::LINE))
625+ .border_color(palette.tokens.thread())
640626 .child(
641627 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),
649632 )
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()
650653 .child(
651654 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),
665663 ),
666664 )
667665 }
@@ -670,8 +668,26 @@ pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) ->
670668 Section(title, rows_column(palette, rows))
671669 }
672670
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+ )
675691 }
676692
677693 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
682698 .child(rows)
683699 }
684700
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()
695703 }
696704
697705 pub(super) struct Editable<'a> {
@@ -713,34 +721,32 @@ pub(super) fn text_row(
713721 let save = editable.save;
714722
715723 div()
716- .p(px(space::MD))
724+ .min_h(px(size::ROW))
725+ .py(px(space::SM))
717726 .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)
726731 .child(
727732 div()
733+ .w(px(size::SIDEBAR))
734+ .flex_shrink_0()
728735 .flex()
729736 .items_center()
730737 .gap(px(space::SM))
731738 .child(field(palette, editable.input).flex_1())
732739 .when(dirty, |this| {
733740 this.child(
734- primary_button(editable.id, palette, move |window, cx| {
741+ clickable(editable.id, palette, move |window, cx| {
735742 entity.update(cx, |yumush, cx| save(yumush, window, cx));
736743 })
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("↵"),
744750 )
745751 }),
746752 )
@@ -832,16 +838,17 @@ pub(super) fn small_button(
832838 ) -> Stateful<Div> {
833839 clickable(id, palette, on_click)
834840 .h(px(size::CONTROL_SM))
835- .px(px(space::MD))
841+ .px(px(space::SM))
836842 .flex()
837843 .items_center()
838844 .rounded(px(radius::MD))
839- .text_size(text(text::LABEL))
845+ .text_size(text(text::UI))
840846 .text_color(color)
841847 }
842848
843849 pub(super) fn delete_control(
844850 id: &'static str,
851+ label: &'static str,
845852 step: DeleteStep,
846853 entity: &Entity<Yumush>,
847854 palette: Palette,
@@ -853,23 +860,19 @@ pub(super) fn delete_control(
853860 small_button(id, palette, palette.danger, move |window, cx| {
854861 entity.update(cx, |yumush, cx| action(yumush, window, cx));
855862 })
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))
861864 .child(if confirming {
862865 w().settings_page.confirm
863866 } else {
864- w().settings_page.delete
867+ label
865868 })
866869 }
867870
868871 pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {
869872 div()
870873 .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))
873876 .flex()
874877 .items_center()
875878 .justify_between()
@@ -877,32 +880,22 @@ pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {
877880 .child(control)
878881 }
879882
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))
890885 }
891886
892887 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())
895890 } else {
896- (transparent_black(), transparent_black(), palette.muted)
891+ (transparent_black(), palette.muted)
897892 };
898893
899894 item.flex()
900895 .items_center()
901896 .justify_center()
902- .rounded(px(radius::SM))
903- .border_1()
897+ .border_b(px(stroke::LINE))
904898 .border_color(border)
905- .bg(background)
906899 .text_color(text)
907900 }
908901