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