forge
Explore
Log in

Don't you dare go Hollow

Full pages are one centred spread: back crumb over the index, the open section as the page heading, readable group captions, one left-aligned empty state, no divider rule

Browse files at this commit

699221c41908a64f5a53e981bcc2df179017f6baAhmet Kaan GümüşParent: c0dbf85
  • style
    • full pages are one centred spread: back crumb over the index, the open section as the page heading, readable group captions, one left-aligned empty state, no divider rule
Show full message
💄 style: full pages are one centred spread: back crumb over the index, the open section as the page heading, readable group captions, one left-aligned empty state, no divider rule
crates/client/design/tokens.tomlmodified+1 -0
@@ -69,6 +69,7 @@ rail = 56
69 avatar_lg = 6469 avatar_lg = 64
70 thumb = 12070 thumb = 120
71 sidebar = 23071 sidebar = 230
72+index = 200
72 talk = 30073 talk = 300
73 popover = 30074 popover = 300
74 sheet = 38075 sheet = 380
crates/client/src/gui/builder.rsmodified+12 -30
@@ -21,20 +21,18 @@ use common::{
21 permission,21 permission,
22 };22 };
23 use gpui_kit::{23 use gpui_kit::{
24- AnyElement, App, Context, Entity, FontWeight, IntoElement, ParentElement, Styled, Window,24+ AnyElement, App, Context, Entity, IntoElement, ParentElement, Styled, Window,
25 assets::IconName,25 assets::IconName,
26- component::{Icon, input::InputState},26+ component::input::InputState,
27 div,27 div,
28- prelude::FluentBuilder as _,
29 px,28 px,
30 };29 };
31 30
32-use self::ui::{accent_button, icon_button, page_heading, plain_button};31+use self::ui::{accent_button, icon_button, plain_button};
33 use super::{32 use super::{
34 Palette, Yumush,33 Palette, Yumush,
35- chat::View,34+ chat::View, entity_action, notify_error,
36- clickable, entity_action, notify_error,35+ settings_page::{frame, heading},
37- settings_page::frame,
38 style::{size, space, text},36 style::{size, space, text},
39 text,37 text,
40 widget::search_text,38 widget::search_text,
@@ -137,7 +135,7 @@ impl Yumush {
137 BuilderTab::Log => self.log_body(entity, palette),135 BuilderTab::Log => self.log_body(entity, palette),
138 };136 };
139 let mut sections = vec![137 let mut sections = vec![
140- page_heading(title, self.tab_actions(tab, entity, palette, cx), palette)138+ heading(title, self.tab_actions(tab, entity, palette, cx), palette)
141 .into_any_element(),139 .into_any_element(),
142 ];140 ];
143 sections.extend(body);141 sections.extend(body);
@@ -146,16 +144,7 @@ impl Yumush {
146 "builder_scroll",144 "builder_scroll",
147 entity,145 entity,
148 palette,146 palette,
149- div()147+ Role::Builder.label(),
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::ALL148 BuilderTab::ALL
160 .map(|tab| {149 .map(|tab| {
161 self.builder_nav_item(tab, entity, palette)150 self.builder_nav_item(tab, entity, palette)
@@ -221,29 +210,22 @@ impl Yumush {
221 entity: &Entity<Self>,210 entity: &Entity<Self>,
222 palette: Palette,211 palette: Palette,
223 ) -> impl IntoElement {212 ) -> impl IntoElement {
224- let label = tab.label();
225- let active = self.chat.builder_tab == tab;
226- let color = if active { palette.text } else { palette.muted };
227 let open = (tab == BuilderTab::Reports)213 let open = (tab == BuilderTab::Reports)
228 .then_some(self.chat.open_reports)214 .then_some(self.chat.open_reports)
229 .filter(|count| *count > 0);215 .filter(|count| *count > 0);
230 216
231- clickable(217+ super::parts::index_item(
232 format!("builder_tab_{}", tab.id()),218 format!("builder_tab_{}", tab.id()),
233- palette,219+ tab.label(),
220+ self.chat.builder_tab == tab,
221+ palette.tokens,
234 entity_action(entity, move |yumush, window, cx| {222 entity_action(entity, move |yumush, window, cx| {
235 yumush.select_builder_tab(tab, window, cx)223 yumush.select_builder_tab(tab, window, cx)
236 }),224 }),
237 )225 )
238- .h(px(size::CONTROL_SM + space::XS))
239- .flex()
240- .items_center()
241- .gap(px(space::SM))
242- .text_color(color)
243- .when(active, |this| this.font_weight(FontWeight::MEDIUM))
244- .child(div().flex_1().min_w_0().truncate().child(label))
245 .children(open.map(|count| {226 .children(open.map(|count| {
246 div()227 div()
228+ .ml(px(space::SM))
247 .text_size(text(text::CAPTION))229 .text_size(text(text::CAPTION))
248 .text_color(palette.danger)230 .text_color(palette.danger)
249 .child(count.to_string())231 .child(count.to_string())
crates/client/src/gui/builder/access.rsmodified+2 -8
@@ -16,15 +16,9 @@ use crate::gui::style::{size, space, text};
16 use crate::gui::{Palette, Yumush, entity_action, millis_time, notify_error, text, widget::field};16 use crate::gui::{Palette, Yumush, entity_action, millis_time, notify_error, text, widget::field};
17 use crate::lang::w;17 use crate::lang::w;
18 18
19-fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {19+fn list_card(header: Div, rows: Vec<Div>, none: &str, palette: Palette) -> Div {
20 let body = if rows.is_empty() {20 let body = if rows.is_empty() {
21- div()21+ super::ui::empty(none, palette)
22- .py(px(space::XL))
23- .flex()
24- .justify_center()
25- .text_size(text(text::CAPTION))
26- .text_color(palette.muted)
27- .child(empty.to_string())
28 } else {22 } else {
29 div().flex().flex_col().children(rows)23 div().flex().flex_col().children(rows)
30 };24 };
crates/client/src/gui/builder/backups.rsmodified+2 -8
@@ -13,7 +13,7 @@ use super::{
13 };13 };
14 use crate::gui::{14 use crate::gui::{
15 Palette, Yumush, entity_action, millis_time, notify_error, storage,15 Palette, Yumush, entity_action, millis_time, notify_error, storage,
16- style::{size, space, text},16+ style::{size, text},
17 text,17 text,
18 };18 };
19 use crate::lang::w;19 use crate::lang::w;
@@ -100,13 +100,7 @@ impl Yumush {
100 })100 })
101 .collect();101 .collect();
102 let body = if rows.is_empty() {102 let body = if rows.is_empty() {
103- div()103+ super::ui::empty(w().builder_backups.no_backups, palette)
104- .py(px(space::XL))
105- .flex()
106- .justify_center()
107- .text_size(text(text::CAPTION))
108- .text_color(palette.muted)
109- .child(w().builder_backups.no_backups)
110 } else {104 } else {
111 div().flex().flex_col().children(rows)105 div().flex().flex_col().children(rows)
112 };106 };
crates/client/src/gui/builder/log.rsmodified+1 -7
@@ -297,13 +297,7 @@ impl Yumush {
297 .map(|entry| builder_log_row(entry, palette))297 .map(|entry| builder_log_row(entry, palette))
298 .collect();298 .collect();
299 let body = if rows.is_empty() {299 let body = if rows.is_empty() {
300- div()300+ super::ui::empty(w().builder_log.no_entries, palette)
301- .py(px(space::XL))
302- .flex()
303- .justify_center()
304- .text_size(text(text::CAPTION))
305- .text_color(palette.muted)
306- .child(w().builder_log.no_entries)
307 } else {301 } else {
308 div().flex().flex_col().children(rows)302 div().flex().flex_col().children(rows)
309 };303 };
crates/client/src/gui/builder/messages.rsmodified+1 -7
@@ -233,13 +233,7 @@ impl Yumush {
233 })233 })
234 .collect();234 .collect();
235 let list = if rows.is_empty() {235 let list = if rows.is_empty() {
236- div()236+ super::ui::empty(w().builder_messages.no_messages, palette)
237- .py(px(space::XL))
238- .flex()
239- .justify_center()
240- .text_size(text(text::CAPTION))
241- .text_color(palette.muted)
242- .child(w().builder_messages.no_messages)
243 } else {237 } else {
244 div()238 div()
245 .relative()239 .relative()
crates/client/src/gui/builder/overview.rsmodified+1 -2
@@ -81,7 +81,6 @@ fn bar_chart(
81 .child(81 .child(
82 div()82 div()
83 .h(px(PANEL_HEIGHT))83 .h(px(PANEL_HEIGHT))
84- .px(px(space::LG))
85 .py(px(space::MD))84 .py(px(space::MD))
86 .flex()85 .flex()
87 .flex_col()86 .flex_col()
@@ -232,7 +231,7 @@ impl Yumush {
232 Vec::new(),231 Vec::new(),
233 palette,232 palette,
234 ))233 ))
235- .child(div().p(px(space::LG)).child(voice_stats::stats_panel(234+ .child(div().pt(px(space::SM)).child(voice_stats::stats_panel(
236 stats,235 stats,
237 &|id| self.chat.name_of(id),236 &|id| self.chat.name_of(id),
238 voice_stats::Detail::Full,237 voice_stats::Detail::Full,
crates/client/src/gui/builder/storage.rsmodified+1 -7
@@ -250,13 +250,7 @@ impl Yumush {
250 })250 })
251 .collect();251 .collect();
252 let body = if rows.is_empty() {252 let body = if rows.is_empty() {
253- div()253+ super::ui::empty(w().builder_storage.no_attachments, palette)
254- .py(px(space::XL))
255- .flex()
256- .justify_center()
257- .text_size(text(text::CAPTION))
258- .text_color(palette.muted)
259- .child(w().builder_storage.no_attachments)
260 } else {254 } else {
261 div().flex().flex_col().children(rows)255 div().flex().flex_col().children(rows)
262 };256 };
crates/client/src/gui/builder/ui.rsmodified+15 -37
@@ -206,15 +206,9 @@ pub(super) fn end_of_day_ms(text: &str) -> Option<u64> {
206 epoch_ms(date.tomorrow().ok()?)?.checked_sub(1)206 epoch_ms(date.tomorrow().ok()?)?.checked_sub(1)
207 }207 }
208 208
209-pub(super) fn rows_body(rows: Vec<Div>, empty: &str, palette: Palette) -> Div {209+pub(super) fn rows_body(rows: Vec<Div>, none: &str, palette: Palette) -> Div {
210 if rows.is_empty() {210 if rows.is_empty() {
211- return div()211+ return empty(none, palette);
212- .py(px(space::XL))
213- .flex()
214- .justify_center()
215- .text_size(text(text::CAPTION))
216- .text_color(palette.muted)
217- .child(empty.to_string());
218 }212 }
219 div().flex().flex_col().children(rows)213 div().flex().flex_col().children(rows)
220 }214 }
@@ -266,24 +260,23 @@ pub(super) fn card_header(title: &str, actions: Vec<AnyElement>, palette: Palett
266 .items_center()260 .items_center()
267 .justify_between()261 .justify_between()
268 .gap(px(space::SM))262 .gap(px(space::SM))
269- .child(263+ .child(crate::gui::parts::section(title.to_string(), palette.tokens))
270- div()
271- .text_size(text(text::CAPTION))
272- .text_color(palette.tokens.faint())
273- .child(title.to_string()),
274- )
275 .children(actions)264 .children(actions)
276 }265 }
277 266
278-pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {267+pub(super) fn empty(label: &str, palette: Palette) -> Div {
268+ div()
269+ .min_h(px(size::ROW))
270+ .flex()
271+ .items_center()
272+ .text_size(text(text::UI))
273+ .text_color(palette.tokens.faint())
274+ .child(label.to_string())
275+}
276+
277+pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, none: &str, palette: Palette) -> Div {
279 let body = if rows.is_empty() {278 let body = if rows.is_empty() {
280- div()279+ empty(none, palette)
281- .py(px(space::XL))
282- .flex()
283- .justify_center()
284- .text_size(text(text::CAPTION))
285- .text_color(palette.muted)
286- .child(empty.to_string())
287 } else {280 } else {
288 div().flex().flex_col().children(rows)281 div().flex().flex_col().children(rows)
289 };282 };
@@ -366,18 +359,3 @@ pub(super) fn pill(label: &str, color: Hsla, palette: Palette) -> Div {
366 .child(label.to_string())359 .child(label.to_string())
367 }360 }
368 361
369-pub(super) fn page_heading(title: &str, actions: Vec<AnyElement>, palette: Palette) -> Div {
370- div()
371- .flex()
372- .items_center()
373- .justify_between()
374- .gap(px(space::SM))
375- .child(
376- div()
377- .text_size(text(text::TITLE))
378- .font_weight(FontWeight::SEMIBOLD)
379- .text_color(palette.text)
380- .child(title.to_string()),
381- )
382- .children(actions)
383-}
crates/client/src/gui/builder/users.rsmodified+1 -7
@@ -496,13 +496,7 @@ impl Yumush {
496 ));496 ));
497 497
498 let body = if rows.is_empty() {498 let body = if rows.is_empty() {
499- div()499+ super::ui::empty(w().builder_users.no_users, palette)
500- .py(px(space::XL))
501- .flex()
502- .justify_center()
503- .text_size(text(text::CAPTION))
504- .text_color(palette.muted)
505- .child(w().builder_users.no_users)
506 } else {500 } else {
507 div().flex().flex_col().children(rows)501 div().flex().flex_col().children(rows)
508 };502 };
crates/client/src/gui/parts.rsmodified+4 -1
@@ -114,7 +114,10 @@ pub fn row(label: impl Into<SharedString>, trailing: impl IntoElement, t: Tokens
114 }114 }
115 115
116 pub fn section(title: impl Into<SharedString>, t: Tokens) -> Div {116 pub fn section(title: impl Into<SharedString>, t: Tokens) -> Div {
117- words(title, Text::Caption, Ink::Faint, t).pb(px(space::XS))117+ words(title, Text::Label, Ink::Dim, t)
118+ .font_weight(FontWeight::MEDIUM)
119+ .pt(px(space::LG))
120+ .pb(px(space::XS))
118 }121 }
119 122
120 #[derive(Clone, Copy)]123 #[derive(Clone, Copy)]
crates/client/src/gui/settings_page.rsmodified+58 -51
@@ -581,10 +581,9 @@ pub(super) fn page(
581 .into_any_element()581 .into_any_element()
582 })582 })
583 .collect();583 .collect();
584- let body = sections584+ let Some(Section(name, body)) = sections.into_iter().nth(selected) else {
585- .into_iter()585+ return frame(id, entity, palette, title, index, Vec::new(), Vec::new());
586- .nth(selected)586+ };
587- .map(|Section(_, body)| body);
588 587
589 frame(588 frame(
590 id,589 id,
@@ -593,10 +592,29 @@ pub(super) fn page(
593 title,592 title,
594 index,593 index,
595 Vec::new(),594 Vec::new(),
596- body.into_iter().collect(),595+ vec![heading(name, Vec::new(), palette).into_any_element(), body],
597 )596 )
598 }597 }
599 598
599+pub(super) fn heading(title: &str, actions: Vec<AnyElement>, palette: Palette) -> Div {
600+ div()
601+ .h(px(size::CONTROL))
602+ .flex()
603+ .items_center()
604+ .justify_between()
605+ .gap(px(space::SM))
606+ .child(
607+ div()
608+ .min_w_0()
609+ .truncate()
610+ .text_size(text(text::TITLE))
611+ .font_weight(FontWeight::SEMIBOLD)
612+ .text_color(palette.tokens.paper())
613+ .child(title.to_string()),
614+ )
615+ .children(actions)
616+}
617+
600 pub(super) fn frame(618 pub(super) fn frame(
601 id: &'static str,619 id: &'static str,
602 entity: &Entity<Yumush>,620 entity: &Entity<Yumush>,
@@ -607,78 +625,67 @@ pub(super) fn frame(
607 body: Vec<AnyElement>,625 body: Vec<AnyElement>,
608 ) -> Div {626 ) -> Div {
609 let back = entity.clone();627 let back = entity.clone();
628+ let top = space::XXL + space::LG;
610 629
611 div()630 div()
612 .flex_1()631 .flex_1()
613 .min_w_0()632 .min_w_0()
614 .min_h_0()633 .min_h_0()
615 .flex()634 .flex()
635+ .child(div().flex_1().flex_basis(px(0.)).min_w_0())
616 .child(636 .child(
617 div()637 div()
618- .w(px(size::SIDEBAR))638+ .w(px(size::INDEX))
619 .flex_shrink_0()639 .flex_shrink_0()
620- .px(px(space::XL))640+ .pt(px(top))
621- .py(px(space::XL))641+ .pb(px(space::XL))
642+ .pl(px(space::XL))
622 .flex()643 .flex()
623 .flex_col()644 .flex_col()
624- .border_r(px(stroke::LINE))
625- .border_color(palette.tokens.thread())
626 .child(645 .child(
627- div()646+ clickable("page_back", palette, move |window, cx| {
628- .pb(px(space::XL))647+ back.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx));
629- .flex()648+ })
630- .items_center()649+ .tip(w().settings_page.back_esc)
631- .gap(px(space::XS))650+ .h(px(size::CONTROL))
632- .ml(px(-space::SM))651+ .mb(px(space::LG))
633- .child(652+ .ml(px(-space::SM))
634- clickable("page_back", palette, move |window, cx| {653+ .px(px(space::SM))
635- back.update(cx, |yumush, cx| {654+ .rounded(px(radius::MD))
636- yumush.show_view(View::Chat, window, cx)655+ .flex()
637- });656+ .items_center()
638- })657+ .gap(px(space::SM))
639- .tip(w().settings_page.back_esc)658+ .min_w_0()
640- .size(px(size::CONTROL_SM))659+ .text_size(text(text::UI))
641- .flex_shrink_0()660+ .text_color(palette.muted)
642- .flex()661+ .child(
643- .items_center()662+ gpui_kit::component::Icon::new(gpui_kit::assets::IconName::ArrowLeft)
644- .justify_center()663+ .size(px(size::ICON_SM))
645- .rounded_full()664+ .flex_shrink_0(),
646- .text_color(palette.muted)665+ )
647- .child(666+ .child(div().min_w_0().truncate().child(title)),
648- gpui_kit::component::Icon::new(
649- gpui_kit::assets::IconName::ArrowLeft,
650- )
651- .size(px(size::ICON)),
652- ),
653- )
654- .child(
655- div()
656- .min_w_0()
657- .text_size(text(text::TITLE))
658- .text_color(palette.tokens.paper())
659- .child(title),
660- ),
661 )667 )
662- .children(index)668+ .child(div().flex().flex_col().children(index))
663- .child(div().flex_1())669+ .child(div().pt(px(space::XL)).flex().flex_col().children(footer)),
664- .children(footer),
665 )670 )
666 .child(671 .child(
667 div()672 div()
668 .id(id)673 .id(id)
669 .flex_1()674 .flex_1()
675+ .flex_basis(px(size::PAGE + space::XXL))
670 .min_w_0()676 .min_w_0()
671 .min_h_0()677 .min_h_0()
672 .overflow_y_scroll()678 .overflow_y_scroll()
673 .child(679 .child(
674 div()680 div()
675 .w_full()681 .w_full()
676- .max_w(px(size::PAGE))682+ .max_w(px(size::PAGE + space::XXL * 2.))
677 .px(px(space::XXL))683 .px(px(space::XXL))
678- .py(px(space::XL))684+ .pt(px(top))
685+ .pb(px(space::XXL * 2.))
679 .flex()686 .flex()
680 .flex_col()687 .flex_col()
681- .gap(px(space::XL))688+ .gap(px(space::LG))
682 .children(body),689 .children(body),
683 ),690 ),
684 )691 )
@@ -700,6 +707,7 @@ pub(super) fn with_danger(section: Section, actions: Vec<AnyElement>) -> Section
700 .when(!actions.is_empty(), |this| {707 .when(!actions.is_empty(), |this| {
701 this.child(708 this.child(
702 div()709 div()
710+ .ml(px(-space::SM))
703 .flex()711 .flex()
704 .items_center()712 .items_center()
705 .gap(px(space::LG))713 .gap(px(space::LG))
@@ -796,7 +804,6 @@ pub(super) fn picture_card(picture: Picture, entity: &Entity<Yumush>, palette: P
796 let remove_entity = entity.clone();804 let remove_entity = entity.clone();
797 805
798 div()806 div()
799- .p(px(space::LG))
800 .flex()807 .flex()
801 .items_center()808 .items_center()
802 .gap(px(space::LG))809 .gap(px(space::LG))