forge
Explore
Log in

Don't you dare go Hollow

Every gui file on tokens (gate allowlist empty)

Browse files at this commit

0b53b2e9893fb4741b2c38ac686a5fbd04c76766Ahmet Kaan GümüşParent: 6874b35
  • feat
    • every gui file on tokens (gate allowlist empty)
    • yumuş shell — bare header with people count, thread line with dots, no message avatars, bare composer, text room list with unread dots and voice lines, stage shows voice lines when nobody shares
Show full message
✨ feat: every gui file on tokens (gate allowlist empty); yumuş shell — bare header with people count, thread line with dots, no message avatars, bare composer, text room list with unread dots and voice lines, stage shows voice lines when nobody shares

35 changed files +1296 -1260

crates/client/src/gui.rsmodified+6 -6
@@ -71,14 +71,14 @@ mod wave;
71 mod widget;71 mod widget;
72 72
73 use auth::Auth;73 use auth::Auth;
74-use style::{Tokens, radius, size, space, text};74+use style::{Tokens, radius, size, space};
75 use chat::{Chat, View};75 use chat::{Chat, View};
76 use voice_settings::VoiceControls;76 use voice_settings::VoiceControls;
77 77
78 actions!(yumush, [FocusFind, CloseSettings]);78 actions!(yumush, [FocusFind, CloseSettings]);
79 79
80 pub fn text(size: f32) -> Rems {80 pub fn text(size: f32) -> Rems {
81- rems(size / text::UI)81+ rems(size / style::text::UI)
82 }82 }
83 83
84 #[derive(Clone, Copy)]84 #[derive(Clone, Copy)]
@@ -349,7 +349,7 @@ impl Render for Tip {
349 .bg(palette.field)349 .bg(palette.field)
350 .text_color(palette.text)350 .text_color(palette.text)
351 .font_family(FONT)351 .font_family(FONT)
352- .text_size(text(text::LABEL))352+ .text_size(text(style::text::LABEL))
353 .child(self.0)353 .child(self.0)
354 }354 }
355 }355 }
@@ -414,7 +414,7 @@ pub fn rank_tag(rank: Option<Rank>, palette: Palette) -> Option<Div> {
414 414
415 Some(415 Some(
416 div()416 div()
417- .text_size(text(text::CAPTION))417+ .text_size(text(style::text::CAPTION))
418 .text_color(color)418 .text_color(color)
419 .child(rank.label()),419 .child(rank.label()),
420 )420 )
@@ -507,7 +507,7 @@ fn connection_notice(connection: &Connection, palette: Palette) -> Option<Div> {
507 .items_center()507 .items_center()
508 .justify_center()508 .justify_center()
509 .gap(px(space::SM))509 .gap(px(space::SM))
510- .text_size(text(text::CAPTION))510+ .text_size(text(style::text::CAPTION))
511 .text_color(color)511 .text_color(color)
512 .child(Spinner::new().xsmall().color(color))512 .child(Spinner::new().xsmall().color(color))
513 .child(label),513 .child(label),
@@ -1300,7 +1300,7 @@ impl Render for Yumush {
1300 .size_full()1300 .size_full()
1301 .bg(palette.window)1301 .bg(palette.window)
1302 .text_color(palette.text)1302 .text_color(palette.text)
1303- .text_size(text(text::UI))1303+ .text_size(text(style::text::UI))
1304 .track_focus(&self.focus)1304 .track_focus(&self.focus)
1305 .on_action(1305 .on_action(
1306 cx.listener(|this, _: &FocusFind, window, cx| this.chat.focus_find(window, cx)),1306 cx.listener(|this, _: &FocusFind, window, cx| this.chat.focus_find(window, cx)),
crates/client/src/gui/auth.rsmodified+19 -22
@@ -13,6 +13,7 @@ use super::{
13 Palette, Route, Tooltip as _, Yumush, badge, clickable, connection_notice, hoverable,13 Palette, Route, Tooltip as _, Yumush, badge, clickable, connection_notice, hoverable,
14 new_input, notify_error, palette, primary_button,14 new_input, notify_error, palette, primary_button,
15 settings_page::{segment, segment_track},15 settings_page::{segment, segment_track},
16+ style::{radius, size, space, text},
16 text,17 text,
17 widget::{field, frame},18 widget::{field, frame},
18 };19 };
@@ -105,11 +106,11 @@ impl Yumush {
105 let action_button = primary_button("auth_button", palette, move |window, cx| {106 let action_button = primary_button("auth_button", palette, move |window, cx| {
106 submit_entity.update(cx, |this, cx| submit(this, window, cx));107 submit_entity.update(cx, |this, cx| submit(this, window, cx));
107 })108 })
108- .h(px(32.))109+ .h(px(size::CONTROL))
109 .flex()110 .flex()
110 .items_center()111 .items_center()
111 .justify_center()112 .justify_center()
112- .rounded(px(8.))113+ .rounded(px(radius::MD))
113 .font_weight(FontWeight::MEDIUM)114 .font_weight(FontWeight::MEDIUM)
114 .child(action_label);115 .child(action_label);
115 116
@@ -132,24 +133,20 @@ impl Yumush {
132 .size_full()133 .size_full()
133 .child(134 .child(
134 div()135 div()
135- .w(px(320.))136+ .w(px(size::POPOVER))
136- .p(px(24.))137+ .p(px(space::XL))
137 .flex()138 .flex()
138 .flex_col()139 .flex_col()
139- .gap(px(12.))140+ .gap(px(space::MD))
140- .rounded(px(10.))
141- .border_1()
142- .border_color(palette.border)
143- .bg(palette.panel)
144 .child(141 .child(
145 div()142 div()
146- .text_size(text(18.))143+ .text_size(text(text::BODY))
147 .font_weight(FontWeight::SEMIBOLD)144 .font_weight(FontWeight::SEMIBOLD)
148 .child(title),145 .child(title),
149 )146 )
150 .children(maintenance.then(|| {147 .children(maintenance.then(|| {
151 div()148 div()
152- .text_size(text(12.))149+ .text_size(text(text::CAPTION))
153 .text_color(palette.muted)150 .text_color(palette.muted)
154 .child("Maintenance")151 .child("Maintenance")
155 }))152 }))
@@ -180,19 +177,19 @@ impl Yumush {
180 hoverable(177 hoverable(
181 format!("saved_{}", account.user_id),178 format!("saved_{}", account.user_id),
182 div()179 div()
183- .h(px(36.))180+ .h(px(size::CONTROL))
184- .px(px(8.))181+ .px(px(space::SM))
185 .flex()182 .flex()
186 .items_center()183 .items_center()
187- .gap(px(8.))184+ .gap(px(space::SM))
188- .rounded(px(6.))185+ .rounded(px(radius::MD))
189 .child(186 .child(
190 badge(187 badge(
191 palette,188 palette,
192 account.user_id,189 account.user_id,
193 &account.username,190 &account.username,
194- px(22.),191+ px(size::CHIP),
195- text(11.),192+ text(text::CAPTION),
196 )193 )
197 .rounded_full(),194 .rounded_full(),
198 )195 )
@@ -209,13 +206,13 @@ impl Yumush {
209 },206 },
210 )207 )
211 .tip("Forget")208 .tip("Forget")
212- .size(px(22.))209+ .size(px(size::CHIP))
213 .flex()210 .flex()
214 .items_center()211 .items_center()
215 .justify_center()212 .justify_center()
216- .rounded(px(5.))213+ .rounded(px(radius::SM))
217 .text_color(palette.muted)214 .text_color(palette.muted)
218- .child(Icon::new(IconName::X).w(px(12.)).h(px(12.))),215+ .child(Icon::new(IconName::X).size(px(size::ICON_SM))),
219 ),216 ),
220 palette,217 palette,
221 )218 )
@@ -228,7 +225,7 @@ impl Yumush {
228 })225 })
229 .collect();226 .collect();
230 227
231- Some(div().flex().flex_col().gap(px(2.)).children(rows))228+ Some(div().flex().flex_col().gap(px(space::XXS)).children(rows))
232 }229 }
233 }230 }
234 231
@@ -248,6 +245,6 @@ fn tab(
248 palette,245 palette,
249 )246 )
250 .flex_1()247 .flex_1()
251- .text_size(text(12.))248+ .text_size(text(text::CAPTION))
252 .child(label)249 .child(label)
253 }250 }
crates/client/src/gui/builder.rsmodified+19 -18
@@ -32,6 +32,7 @@ use gpui_kit::{
32 use self::ui::{accent_button, icon_button, page_heading, plain_button};32 use self::ui::{accent_button, icon_button, page_heading, plain_button};
33 use super::{33 use super::{
34 Palette, Yumush, chat::View, clickable, entity_action, notify_error, settings_page::header,34 Palette, Yumush, chat::View, clickable, entity_action, notify_error, settings_page::header,
35+ style::{radius, size, space, text},
35 text, widget::search_text,36 text, widget::search_text,
36 };37 };
37 use crate::net::NetworkHandle;38 use crate::net::NetworkHandle;
@@ -158,13 +159,13 @@ impl Yumush {
158 .child(159 .child(
159 div()160 div()
160 .w_full()161 .w_full()
161- .max_w(px(960.))162+ .max_w(px(size::PAGE))
162 .mx_auto()163 .mx_auto()
163- .px(px(32.))164+ .px(px(space::XXL))
164- .py(px(28.))165+ .py(px(space::XXL))
165 .flex()166 .flex()
166 .flex_col()167 .flex_col()
167- .gap(px(20.))168+ .gap(px(space::XL))
168 .children(sections),169 .children(sections),
169 ),170 ),
170 ),171 ),
@@ -219,12 +220,12 @@ impl Yumush {
219 220
220 fn builder_rail(&self, entity: &Entity<Self>, palette: Palette) -> Div {221 fn builder_rail(&self, entity: &Entity<Self>, palette: Palette) -> Div {
221 div()222 div()
222- .w(px(200.))223+ .w(px(size::SIDEBAR))
223 .flex_shrink_0()224 .flex_shrink_0()
224 .flex()225 .flex()
225 .flex_col()226 .flex_col()
226- .gap(px(2.))227+ .gap(px(space::XXS))
227- .p(px(8.))228+ .p(px(space::SM))
228 .bg(palette.panel)229 .bg(palette.panel)
229 .border_r_1()230 .border_r_1()
230 .border_color(palette.border)231 .border_color(palette.border)
@@ -254,24 +255,24 @@ impl Yumush {
254 yumush.select_builder_tab(tab, window, cx)255 yumush.select_builder_tab(tab, window, cx)
255 }),256 }),
256 )257 )
257- .h(px(32.))258+ .h(px(size::CONTROL))
258- .px(px(10.))259+ .px(px(space::MD))
259 .flex()260 .flex()
260 .items_center()261 .items_center()
261- .gap(px(8.))262+ .gap(px(space::SM))
262- .rounded(px(6.))263+ .rounded(px(radius::MD))
263- .text_size(text(13.))264+ .text_size(text(text::LABEL))
264 .text_color(color)265 .text_color(color)
265 .when(active, |this| this.bg(palette.hover))266 .when(active, |this| this.bg(palette.hover))
266- .child(Icon::new(icon).w(px(14.)).h(px(14.)).text_color(color))267+ .child(Icon::new(icon).size(px(size::ICON_SM)).text_color(color))
267 .child(div().flex_1().min_w_0().truncate().child(label))268 .child(div().flex_1().min_w_0().truncate().child(label))
268 .children(open.map(|count| {269 .children(open.map(|count| {
269 div()270 div()
270- .px(px(6.))271+ .px(px(space::XS))
271 .rounded_full()272 .rounded_full()
272 .bg(palette.accent)273 .bg(palette.accent)
273 .text_color(palette.on_accent)274 .text_color(palette.on_accent)
274- .text_size(text(11.))275+ .text_size(text(text::CAPTION))
275 .child(count.to_string())276 .child(count.to_string())
276 }))277 }))
277 }278 }
@@ -283,12 +284,12 @@ impl Yumush {
283 });284 });
284 285
285 div()286 div()
286- .h(px(32.))287+ .h(px(size::CONTROL))
287- .px(px(10.))288+ .px(px(space::MD))
288 .flex()289 .flex()
289 .items_center()290 .items_center()
290 .justify_between()291 .justify_between()
291- .text_size(text(13.))292+ .text_size(text(text::LABEL))
292 .text_color(palette.muted)293 .text_color(palette.muted)
293 .child("Ghost")294 .child("Ghost")
294 .child(295 .child(
crates/client/src/gui/builder/access.rsmodified+14 -13
@@ -13,15 +13,16 @@ use super::ui::{
13 toolbar,13 toolbar,
14 };14 };
15 use crate::gui::STAMP;15 use crate::gui::STAMP;
16+use crate::gui::style::{size, space, text};
16 use crate::gui::{Palette, Yumush, entity_action, millis_time, notify_error, text, widget::field};17 use crate::gui::{Palette, Yumush, entity_action, millis_time, notify_error, text, widget::field};
17 18
18 fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {19 fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {
19 let body = if rows.is_empty() {20 let body = if rows.is_empty() {
20 div()21 div()
21- .py(px(24.))22+ .py(px(space::XL))
22 .flex()23 .flex()
23 .justify_center()24 .justify_center()
24- .text_size(text(12.))25+ .text_size(text(text::CAPTION))
25 .text_color(palette.muted)26 .text_color(palette.muted)
26 .child(empty.to_string())27 .child(empty.to_string())
27 } else {28 } else {
@@ -52,12 +53,12 @@ fn invite_row(
52 );53 );
53 54
54 div()55 div()
55- .min_h(px(44.))56+ .min_h(px(size::ROW))
56- .px(px(14.))57+ .px(px(space::LG))
57- .py(px(10.))58+ .py(px(space::MD))
58 .flex()59 .flex()
59 .items_center()60 .items_center()
60- .gap(px(10.))61+ .gap(px(space::MD))
61 .child(62 .child(
62 div()63 div()
63 .flex_1()64 .flex_1()
@@ -72,7 +73,7 @@ fn invite_row(
72 )73 )
73 .child(74 .child(
74 div()75 div()
75- .text_size(text(11.))76+ .text_size(text(text::CAPTION))
76 .text_color(palette.muted)77 .text_color(palette.muted)
77 .truncate()78 .truncate()
78 .child(format!(79 .child(format!(
@@ -110,12 +111,12 @@ fn ban_row(ban: &ServerBan, entity: &Entity<Yumush>, palette: Palette) -> Div {
110 };111 };
111 112
112 div()113 div()
113- .min_h(px(44.))114+ .min_h(px(size::ROW))
114- .px(px(14.))115+ .px(px(space::LG))
115- .py(px(10.))116+ .py(px(space::MD))
116 .flex()117 .flex()
117 .items_center()118 .items_center()
118- .gap(px(10.))119+ .gap(px(space::MD))
119 .child(pill(kind, palette.text, palette))120 .child(pill(kind, palette.text, palette))
120 .child(121 .child(
121 div()122 div()
@@ -131,7 +132,7 @@ fn ban_row(ban: &ServerBan, entity: &Entity<Yumush>, palette: Palette) -> Div {
131 )132 )
132 .children(ban.reason.as_ref().map(|reason| {133 .children(ban.reason.as_ref().map(|reason| {
133 div()134 div()
134- .text_size(text(11.))135+ .text_size(text(text::CAPTION))
135 .text_color(palette.muted)136 .text_color(palette.muted)
136 .truncate()137 .truncate()
137 .child(reason.clone())138 .child(reason.clone())
@@ -253,7 +254,7 @@ impl Yumush {
253 pub(super) fn access_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {254 pub(super) fn access_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {
254 let controls = toolbar(vec![255 let controls = toolbar(vec![
255 fixed(80., field(palette, &self.chat.invite_uses)),256 fixed(80., field(palette, &self.chat.invite_uses)),
256- fixed(90., field(palette, &self.chat.invite_hours)),257+ fixed(size::THUMB, field(palette, &self.chat.invite_hours)),
257 accent_button(258 accent_button(
258 "create_invite",259 "create_invite",
259 "Create",260 "Create",
crates/client/src/gui/builder/backups.rsmodified+14 -9
@@ -11,7 +11,13 @@ use super::{
11 save_directory,11 save_directory,
12 ui::{accent_button, card, card_header, confirmed, delete_icon_button, icon_button, list_row},12 ui::{accent_button, card, card_header, confirmed, delete_icon_button, icon_button, list_row},
13 };13 };
14-use crate::gui::{DATE, Palette, Yumush, entity_action, millis_time, notify_error, storage, text};14+use crate::gui::{
15+ DATE, Palette, Yumush, entity_action, millis_time, notify_error, storage,
16+ style::{size, space, text},
17+ text,
18+};
19+
20+const STORAGE_WIDTH: f32 = 72.;
15 21
16 fn backup_row(info: &BackupInfo, pending: bool, entity: &Entity<Yumush>, palette: Palette) -> Div {22 fn backup_row(info: &BackupInfo, pending: bool, entity: &Entity<Yumush>, palette: Palette) -> Div {
17 let export_name = info.name.clone();23 let export_name = info.name.clone();
@@ -39,8 +45,7 @@ fn backup_row(info: &BackupInfo, pending: bool, entity: &Entity<Yumush>, palette
39 list_row()45 list_row()
40 .child(46 .child(
41 Icon::new(IconName::HardDrive)47 Icon::new(IconName::HardDrive)
42- .w(px(16.))48+ .size(px(size::ICON))
43- .h(px(16.))
44 .flex_shrink_0()49 .flex_shrink_0()
45 .text_color(palette.muted),50 .text_color(palette.muted),
46 )51 )
@@ -49,24 +54,24 @@ fn backup_row(info: &BackupInfo, pending: bool, entity: &Entity<Yumush>, palette
49 .flex_1()54 .flex_1()
50 .min_w_0()55 .min_w_0()
51 .truncate()56 .truncate()
52- .text_size(text(13.))57+ .text_size(text(text::LABEL))
53 .text_color(palette.text)58 .text_color(palette.text)
54 .child(info.name.clone()),59 .child(info.name.clone()),
55 )60 )
56 .child(61 .child(
57 div()62 div()
58 .flex_shrink_0()63 .flex_shrink_0()
59- .text_size(text(12.))64+ .text_size(text(text::CAPTION))
60 .text_color(palette.muted)65 .text_color(palette.muted)
61 .child(millis_time(info.created_ms, DATE)),66 .child(millis_time(info.created_ms, DATE)),
62 )67 )
63 .child(68 .child(
64 div()69 div()
65- .w(px(72.))70+ .w(px(STORAGE_WIDTH))
66 .flex_shrink_0()71 .flex_shrink_0()
67 .flex()72 .flex()
68 .justify_end()73 .justify_end()
69- .text_size(text(12.))74+ .text_size(text(text::CAPTION))
70 .text_color(palette.muted)75 .text_color(palette.muted)
71 .child(storage(info.size_bytes)),76 .child(storage(info.size_bytes)),
72 )77 )
@@ -95,10 +100,10 @@ impl Yumush {
95 .collect();100 .collect();
96 let body = if rows.is_empty() {101 let body = if rows.is_empty() {
97 div()102 div()
98- .py(px(24.))103+ .py(px(space::XL))
99 .flex()104 .flex()
100 .justify_center()105 .justify_center()
101- .text_size(text(12.))106+ .text_size(text(text::CAPTION))
102 .text_color(palette.muted)107 .text_color(palette.muted)
103 .child("No backups")108 .child("No backups")
104 } else {109 } else {
crates/client/src/gui/builder/communities.rsmodified+23 -22
@@ -17,7 +17,10 @@ use super::{
17 };17 };
18 use crate::gui::{18 use crate::gui::{
19 Palette, Yumush, avatar, chat::View, community_icon, entity_action, notify_error,19 Palette, Yumush, avatar, chat::View, community_icon, entity_action, notify_error,
20- profile::user_link, text, widget::search_text,20+ profile::user_link,
21+ style::{radius, size, space, text},
22+ text,
23+ widget::search_text,
21 };24 };
22 25
23 impl Yumush {26 impl Yumush {
@@ -291,15 +294,15 @@ impl Yumush {
291 card(palette)294 card(palette)
292 .child(295 .child(
293 div()296 div()
294- .px(px(14.))297+ .px(px(space::LG))
295- .py(px(10.))298+ .py(px(space::MD))
296 .flex()299 .flex()
297 .items_center()300 .items_center()
298 .border_b_1()301 .border_b_1()
299 .border_color(palette.border)302 .border_color(palette.border)
300 .child(303 .child(
301 div()304 div()
302- .w(px(240.))305+ .w(px(size::SIDEBAR))
303 .child(Input::new(&self.chat.builder_search)),306 .child(Input::new(&self.chat.builder_search)),
304 ),307 ),
305 )308 )
@@ -318,11 +321,11 @@ impl Yumush {
318 let user_id = member.user.id;321 let user_id = member.user.id;
319 322
320 div()323 div()
321- .h(px(40.))324+ .h(px(size::ROW))
322- .px(px(12.))325+ .px(px(space::MD))
323 .flex()326 .flex()
324 .items_center()327 .items_center()
325- .gap(px(8.))328+ .gap(px(space::SM))
326 .child(329 .child(
327 div().flex_1().min_w_0().flex().child(user_link(330 div().flex_1().min_w_0().flex().child(user_link(
328 format!("transfer_user_{}", member.user.id),331 format!("transfer_user_{}", member.user.id),
@@ -331,12 +334,12 @@ impl Yumush {
331 div()334 div()
332 .flex()335 .flex()
333 .items_center()336 .items_center()
334- .gap(px(8.))337+ .gap(px(space::SM))
335 .child(avatar(338 .child(avatar(
336 palette,339 palette,
337 &member.user,340 &member.user,
338- px(20.),341+ px(size::AVATAR),
339- text(10.),342+ text(text::CAPTION),
340 &self.chat.avatars,343 &self.chat.avatars,
341 ))344 ))
342 .child(345 .child(
@@ -383,17 +386,17 @@ impl Yumush {
383 let meta = format!("{} members{owner}", summary.members);386 let meta = format!("{} members{owner}", summary.members);
384 387
385 let row = div()388 let row = div()
386- .min_h(px(48.))389+ .min_h(px(size::ROW))
387- .px(px(14.))390+ .px(px(space::LG))
388- .py(px(8.))391+ .py(px(space::SM))
389 .flex()392 .flex()
390 .items_center()393 .items_center()
391- .gap(px(10.))394+ .gap(px(space::MD))
392 .child(community_icon(395 .child(community_icon(
393 palette,396 palette,
394 community,397 community,
395- px(28.),398+ px(size::AVATAR),
396- text(11.),399+ text(text::CAPTION),
397 &self.chat.avatars,400 &self.chat.avatars,
398 ))401 ))
399 .child(402 .child(
@@ -404,7 +407,7 @@ impl Yumush {
404 .flex_col()407 .flex_col()
405 .child(408 .child(
406 div()409 div()
407- .text_size(text(13.))410+ .text_size(text(text::LABEL))
408 .font_weight(FontWeight::MEDIUM)411 .font_weight(FontWeight::MEDIUM)
409 .text_color(palette.text)412 .text_color(palette.text)
410 .truncate()413 .truncate()
@@ -412,7 +415,7 @@ impl Yumush {
412 )415 )
413 .child(416 .child(
414 div()417 div()
415- .text_size(text(11.))418+ .text_size(text(text::CAPTION))
416 .text_color(palette.muted)419 .text_color(palette.muted)
417 .truncate()420 .truncate()
418 .child(meta),421 .child(meta),
@@ -498,13 +501,11 @@ impl Yumush {
498 .flex_col()501 .flex_col()
499 .child(row)502 .child(row)
500 .children(expanded.then(|| {503 .children(expanded.then(|| {
501- div().px(px(14.)).pb(px(10.)).child(504+ div().px(px(space::LG)).pb(px(space::MD)).child(
502 div()505 div()
503 .flex()506 .flex()
504 .flex_col()507 .flex_col()
505- .rounded(px(6.))508+ .rounded(px(radius::MD))
506- .border_1()
507- .border_color(palette.border)
508 .children(self.transfer_rows(entity, palette)),509 .children(self.transfer_rows(entity, palette)),
509 )510 )
510 }))511 }))
crates/client/src/gui/builder/log.rsmodified+16 -15
@@ -21,7 +21,9 @@ use crate::gui::STAMP;
21 use crate::gui::{21 use crate::gui::{
22 Palette, Yumush,22 Palette, Yumush,
23 community_settings::user_name,23 community_settings::user_name,
24- entity_action, millis_time, notify_error, text,24+ entity_action, millis_time, notify_error,
25+ style::{size, space, text},
26+ text,
25 widget::{field, search_text},27 widget::{field, search_text},
26 };28 };
27 29
@@ -181,8 +183,7 @@ fn builder_log_row(entry: &AdminLogEntry, palette: Palette) -> Div {
181 list_row()183 list_row()
182 .child(184 .child(
183 Icon::new(action_icon(&entry.action))185 Icon::new(action_icon(&entry.action))
184- .w(px(14.))186+ .size(px(size::ICON_SM))
185- .h(px(14.))
186 .text_color(palette.muted),187 .text_color(palette.muted),
187 )188 )
188 .child(189 .child(
@@ -191,17 +192,17 @@ fn builder_log_row(entry: &AdminLogEntry, palette: Palette) -> Div {
191 .min_w_0()192 .min_w_0()
192 .flex()193 .flex()
193 .flex_col()194 .flex_col()
194- .gap(px(2.))195+ .gap(px(space::XXS))
195 .child(196 .child(
196 div()197 div()
197 .truncate()198 .truncate()
198- .text_size(text(13.))199+ .text_size(text(text::LABEL))
199 .text_color(palette.text)200 .text_color(palette.text)
200 .child(builder_log_text(entry)),201 .child(builder_log_text(entry)),
201 )202 )
202 .child(203 .child(
203 div()204 div()
204- .text_size(text(11.))205+ .text_size(text(text::CAPTION))
205 .text_color(palette.muted)206 .text_color(palette.muted)
206 .child(millis_time(entry.created_at, STAMP)),207 .child(millis_time(entry.created_at, STAMP)),
207 ),208 ),
@@ -283,11 +284,11 @@ impl Yumush {
283 284
284 pub(super) fn log_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {285 pub(super) fn log_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {
285 let filters = toolbar(vec![286 let filters = toolbar(vec![
286- fixed(130., field(palette, &self.chat.builder_log_actor)),287+ fixed(size::THUMB,field(palette, &self.chat.builder_log_actor)),
287- fixed(130., field(palette, &self.chat.builder_log_target)),288+ fixed(size::THUMB,field(palette, &self.chat.builder_log_target)),
288- fixed(160., Select::new(&self.chat.builder_log_action)),289+ fixed(size::THUMB,Select::new(&self.chat.builder_log_action)),
289- fixed(150., field(palette, &self.chat.builder_log_from)),290+ fixed(size::THUMB,field(palette, &self.chat.builder_log_from)),
290- fixed(150., field(palette, &self.chat.builder_log_to)),291+ fixed(size::THUMB,field(palette, &self.chat.builder_log_to)),
291 accent_button(292 accent_button(
292 "apply_builder_log",293 "apply_builder_log",
293 "Apply",294 "Apply",
@@ -311,10 +312,10 @@ impl Yumush {
311 .collect();312 .collect();
312 let body = if rows.is_empty() {313 let body = if rows.is_empty() {
313 div()314 div()
314- .py(px(24.))315+ .py(px(space::XL))
315 .flex()316 .flex()
316 .justify_center()317 .justify_center()
317- .text_size(text(12.))318+ .text_size(text(text::CAPTION))
318 .text_color(palette.muted)319 .text_color(palette.muted)
319 .child("No entries")320 .child("No entries")
320 } else {321 } else {
@@ -325,8 +326,8 @@ impl Yumush {
325 card(palette)326 card(palette)
326 .child(327 .child(
327 div()328 div()
328- .px(px(14.))329+ .px(px(space::LG))
329- .py(px(10.))330+ .py(px(space::MD))
330 .border_b_1()331 .border_b_1()
331 .border_color(palette.border)332 .border_color(palette.border)
332 .child(filters),333 .child(filters),
crates/client/src/gui/builder/messages.rsmodified+15 -14
@@ -17,6 +17,7 @@ use super::ui::{
17 list_row, start_of_day_ms,17 list_row, start_of_day_ms,
18 };18 };
19 use crate::gui::YEAR_STAMP;19 use crate::gui::YEAR_STAMP;
20+use crate::gui::style::{size, space, text};
20 use crate::gui::{21 use crate::gui::{
21 Palette, Yumush, avatar,22 Palette, Yumush, avatar,
22 community_settings::user_name,23 community_settings::user_name,
@@ -88,12 +89,12 @@ fn message_hit_row(
88 .min_w_0()89 .min_w_0()
89 .flex()90 .flex()
90 .flex_col()91 .flex_col()
91- .gap(px(2.))92+ .gap(px(space::XXS))
92 .child(93 .child(
93 div()94 div()
94 .flex()95 .flex()
95 .items_center()96 .items_center()
96- .gap(px(6.))97+ .gap(px(space::SM))
97 .min_w_0()98 .min_w_0()
98 .child(user_link(99 .child(user_link(
99 format!("hit_author_{}", hit.message.id),100 format!("hit_author_{}", hit.message.id),
@@ -101,7 +102,7 @@ fn message_hit_row(
101 entity,102 entity,
102 div()103 div()
103 .truncate()104 .truncate()
104- .text_size(text(13.))105+ .text_size(text(text::LABEL))
105 .font_weight(FontWeight::MEDIUM)106 .font_weight(FontWeight::MEDIUM)
106 .text_color(palette.text)107 .text_color(palette.text)
107 .child(user_name(&hit.author).to_string()),108 .child(user_name(&hit.author).to_string()),
@@ -110,21 +111,21 @@ fn message_hit_row(
110 div()111 div()
111 .min_w_0()112 .min_w_0()
112 .truncate()113 .truncate()
113- .text_size(text(11.))114+ .text_size(text(text::CAPTION))
114 .text_color(palette.muted)115 .text_color(palette.muted)
115 .child(hit.community.clone()),116 .child(hit.community.clone()),
116 )117 )
117 .child(118 .child(
118 div()119 div()
119 .flex_shrink_0()120 .flex_shrink_0()
120- .text_size(text(11.))121+ .text_size(text(text::CAPTION))
121 .text_color(palette.muted)122 .text_color(palette.muted)
122 .child(millis_time(hit.message.created_at, YEAR_STAMP)),123 .child(millis_time(hit.message.created_at, YEAR_STAMP)),
123 ),124 ),
124 )125 )
125 .child(126 .child(
126 div()127 div()
127- .text_size(text(13.))128+ .text_size(text(text::LABEL))
128 .text_color(palette.body)129 .text_color(palette.body)
129 .line_clamp(2)130 .line_clamp(2)
130 .child(hit.message.body.clone()),131 .child(hit.message.body.clone()),
@@ -134,7 +135,7 @@ fn message_hit_row(
134 div()135 div()
135 .flex()136 .flex()
136 .items_center()137 .items_center()
137- .gap(px(4.))138+ .gap(px(space::XS))
138 .flex_shrink_0()139 .flex_shrink_0()
139 .child(open)140 .child(open)
140 .child(delete)141 .child(delete)
@@ -145,11 +146,11 @@ fn message_hit_row(
145 impl Yumush {146 impl Yumush {
146 pub(super) fn messages_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {147 pub(super) fn messages_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {
147 let filters = div()148 let filters = div()
148- .px(px(14.))149+ .px(px(space::LG))
149- .py(px(12.))150+ .py(px(space::MD))
150 .flex()151 .flex()
151 .flex_col()152 .flex_col()
152- .gap(px(8.))153+ .gap(px(space::SM))
153 .child(154 .child(
154 div().flex().child(155 div().flex().child(
155 div()156 div()
@@ -163,7 +164,7 @@ impl Yumush {
163 .flex()164 .flex()
164 .flex_wrap()165 .flex_wrap()
165 .items_center()166 .items_center()
166- .gap(px(8.))167+ .gap(px(space::SM))
167 .children(168 .children(
168 [169 [
169 &self.chat.builder_message_user,170 &self.chat.builder_message_user,
@@ -171,7 +172,7 @@ impl Yumush {
171 &self.chat.builder_message_from,172 &self.chat.builder_message_from,
172 &self.chat.builder_message_to,173 &self.chat.builder_message_to,
173 ]174 ]
174- .map(|input| div().flex_1().min_w(px(140.)).child(field(palette, input))),175+ .map(|input| div().flex_1().min_w(px(size::THUMB)).child(field(palette, input))),
175 )176 )
176 .child(accent_button(177 .child(accent_button(
177 "search_messages",178 "search_messages",
@@ -193,9 +194,9 @@ impl Yumush {
193 .as_ref()194 .as_ref()
194 .is_some_and(|author| self.chat.pending_builder_purge == Some(author.id));195 .is_some_and(|author| self.chat.pending_builder_purge == Some(author.id));
195 let picture = match &hit.author {196 let picture = match &hit.author {
196- Some(author) => avatar(palette, author, px(28.), text(11.), &self.chat.avatars),197+ Some(author) => avatar(palette, author, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),
197 None => div()198 None => div()
198- .size(px(28.))199+ .size(px(size::AVATAR))
199 .flex_shrink_0()200 .flex_shrink_0()
200 .rounded_full()201 .rounded_full()
201 .bg(palette.hover),202 .bg(palette.hover),
crates/client/src/gui/builder/overview.rsmodified+22 -17
@@ -8,9 +8,14 @@ use gpui_kit::{Context, Div, IntoElement, ParentElement, Styled, Window, div, px
8 use jiff::Timestamp;8 use jiff::Timestamp;
9 9
10 use super::ui::{card, card_header, stat_tile};10 use super::ui::{card, card_header, stat_tile};
11-use crate::gui::{DAY, Palette, Yumush, storage, text};11+use crate::gui::{
12+ DAY, Palette, Yumush, storage,
13+ style::{radius, size, space, text},
14+ text,
15+};
12 16
13 const CHART_HEIGHT: f32 = 80.;17 const CHART_HEIGHT: f32 = 80.;
18+const PANEL_HEIGHT: f32 = 140.;
14 19
15 fn day_label(day: u64) -> String {20 fn day_label(day: u64) -> String {
16 Timestamp::from_millisecond((day * DAY_MILLIS) as i64)21 Timestamp::from_millisecond((day * DAY_MILLIS) as i64)
@@ -19,10 +24,10 @@ fn day_label(day: u64) -> String {
19 }24 }
20 25
21 fn tile_row(tiles: &[(&str, String)], palette: Palette) -> Div {26 fn tile_row(tiles: &[(&str, String)], palette: Palette) -> Div {
22- div().flex().gap(px(12.)).children(27+ div().flex().gap(px(space::MD)).children(
23 tiles28 tiles
24 .iter()29 .iter()
25- .map(|(label, value)| stat_tile(label, value, palette).flex_1().min_w(px(200.))),30+ .map(|(label, value)| stat_tile(label, value, palette).flex_1().min_w(px(size::SIDEBAR))),
26 )31 )
27 }32 }
28 33
@@ -51,7 +56,7 @@ fn bar_chart(
51 title,56 title,
52 vec![57 vec![
53 div()58 div()
54- .text_size(text(11.))59+ .text_size(text(text::CAPTION))
55 .text_color(palette.muted)60 .text_color(palette.muted)
56 .child(summary.to_string())61 .child(summary.to_string())
57 .into_any_element(),62 .into_any_element(),
@@ -60,15 +65,15 @@ fn bar_chart(
60 ))65 ))
61 .child(66 .child(
62 div()67 div()
63- .h(px(140.))68+ .h(px(PANEL_HEIGHT))
64- .px(px(14.))69+ .px(px(space::LG))
65- .py(px(12.))70+ .py(px(space::MD))
66 .flex()71 .flex()
67 .flex_col()72 .flex_col()
68- .gap(px(4.))73+ .gap(px(space::XS))
69 .child(74 .child(
70 div()75 div()
71- .text_size(text(10.))76+ .text_size(text(text::CAPTION))
72 .text_color(palette.muted)77 .text_color(palette.muted)
73 .child(maximum.to_string()),78 .child(maximum.to_string()),
74 )79 )
@@ -77,28 +82,28 @@ fn bar_chart(
77 .h(px(CHART_HEIGHT))82 .h(px(CHART_HEIGHT))
78 .flex()83 .flex()
79 .items_end()84 .items_end()
80- .gap(px(2.))85+ .gap(px(space::XXS))
81 .children(values.iter().map(|&value| {86 .children(values.iter().map(|&value| {
82 let (height, color) = if value == 0 {87 let (height, color) = if value == 0 {
83- (2., palette.hover)88+ (space::XXS, palette.hover)
84 } else {89 } else {
85 (90 (
86- (CHART_HEIGHT * value as f32 / maximum as f32).max(2.),91+ (CHART_HEIGHT * value as f32 / maximum as f32).max(space::XXS),
87- palette.accent.opacity(0.85),92+ palette.accent,
88 )93 )
89 };94 };
90 95
91- div().flex_1().h(px(height)).rounded_t(px(2.)).bg(color)96+ div().flex_1().h(px(height)).rounded_t(px(radius::SM)).bg(color)
92 })),97 })),
93 )98 )
94 .child(99 .child(
95 div()100 div()
96- .pt(px(4.))101+ .pt(px(space::XS))
97 .border_t_1()102 .border_t_1()
98 .border_color(palette.border)103 .border_color(palette.border)
99 .flex()104 .flex()
100 .justify_between()105 .justify_between()
101- .text_size(text(11.))106+ .text_size(text(text::CAPTION))
102 .text_color(palette.muted)107 .text_color(palette.muted)
103 .child(first)108 .child(first)
104 .child(last),109 .child(last),
@@ -149,7 +154,7 @@ impl Yumush {
149 rows.push(154 rows.push(
150 div()155 div()
151 .flex()156 .flex()
152- .gap(px(12.))157+ .gap(px(space::MD))
153 .child(bar_chart(158 .child(bar_chart(
154 "Active users",159 "Active users",
155 stats,160 stats,
crates/client/src/gui/builder/reports.rsmodified+34 -21
@@ -19,7 +19,8 @@ use crate::{
19 entity_action, millis_time, notify_error,19 entity_action, millis_time, notify_error,
20 profile::user_link,20 profile::user_link,
21 settings_page::{segment, segment_track},21 settings_page::{segment, segment_track},
22- text,22+ style::{radius, size, space, text},
23+ text as text_fn,
23 },24 },
24 net::{Fail, NetworkHandle},25 net::{Fail, NetworkHandle},
25 };26 };
@@ -180,7 +181,7 @@ impl Yumush {
180 self.chat.report_filter == status,181 self.chat.report_filter == status,
181 palette,182 palette,
182 )183 )
183- .px(px(10.))184+ .px(px(space::MD))
184 .child(label)185 .child(label)
185 })),186 })),
186 )187 )
@@ -207,17 +208,29 @@ impl Yumush {
207 palette: Palette,208 palette: Palette,
208 ) -> Div {209 ) -> Div {
209 let target_avatar = match &report.target {210 let target_avatar = match &report.target {
210- Some(user) => {211+ Some(user) => avatar(
211- avatar(palette, user, px(20.), text(9.), &self.chat.avatars).into_any_element()212+ palette,
212- }213+ user,
213- None => badge(palette, report.id, "someone", px(20.), text(9.)).into_any_element(),214+ px(size::AVATAR),
215+ text_fn(text::CAPTION),
216+ &self.chat.avatars,
217+ )
218+ .into_any_element(),
219+ None => badge(
220+ palette,
221+ report.id,
222+ "someone",
223+ px(size::AVATAR),
224+ text_fn(text::CAPTION),
225+ )
226+ .into_any_element(),
214 };227 };
215 let head = div()228 let head = div()
216 .flex_1()229 .flex_1()
217 .min_w_0()230 .min_w_0()
218 .flex()231 .flex()
219 .items_center()232 .items_center()
220- .gap(px(8.))233+ .gap(px(space::SM))
221 .child(user_link(234 .child(user_link(
222 format!("report_target_{}", report.id),235 format!("report_target_{}", report.id),
223 report.target.as_ref(),236 report.target.as_ref(),
@@ -225,7 +238,7 @@ impl Yumush {
225 div()238 div()
226 .flex()239 .flex()
227 .items_center()240 .items_center()
228- .gap(px(8.))241+ .gap(px(space::SM))
229 .child(target_avatar)242 .child(target_avatar)
230 .child(243 .child(
231 div()244 div()
@@ -244,14 +257,14 @@ impl Yumush {
244 report.reporter.as_ref(),257 report.reporter.as_ref(),
245 entity,258 entity,
246 div()259 div()
247- .text_size(text(11.))260+ .text_size(text_fn(text::CAPTION))
248 .text_color(palette.muted)261 .text_color(palette.muted)
249 .truncate()262 .truncate()
250 .child(format!("reported by {}", user_name(&report.reporter))),263 .child(format!("reported by {}", user_name(&report.reporter))),
251 ));264 ));
252 let meta = div()265 let meta = div()
253 .flex_shrink_0()266 .flex_shrink_0()
254- .text_size(text(11.))267+ .text_size(text_fn(text::CAPTION))
255 .text_color(palette.muted)268 .text_color(palette.muted)
256 .child(format!(269 .child(format!(
257 "{} · {}",270 "{} · {}",
@@ -261,38 +274,38 @@ impl Yumush {
261 let actions = self.report_actions(report, entity, palette);274 let actions = self.report_actions(report, entity, palette);
262 let handled = (report.status != ReportStatus::Open).then(|| {275 let handled = (report.status != ReportStatus::Open).then(|| {
263 div()276 div()
264- .text_size(text(11.))277+ .text_size(text_fn(text::CAPTION))
265 .text_color(palette.muted)278 .text_color(palette.muted)
266 .child(format!("by {}", user_name(&report.handled_by)))279 .child(format!("by {}", user_name(&report.handled_by)))
267 });280 });
268 281
269 div()282 div()
270- .px(px(14.))283+ .px(px(space::LG))
271- .py(px(10.))284+ .py(px(space::MD))
272 .flex()285 .flex()
273 .flex_col()286 .flex_col()
274- .gap(px(6.))287+ .gap(px(space::SM))
275 .child(288 .child(
276 div()289 div()
277 .flex()290 .flex()
278 .items_center()291 .items_center()
279- .gap(px(8.))292+ .gap(px(space::SM))
280 .child(head)293 .child(head)
281 .child(meta),294 .child(meta),
282 )295 )
283 .child(296 .child(
284 div()297 div()
285- .text_size(text(13.))298+ .text_size(text_fn(text::LABEL))
286 .text_color(palette.body)299 .text_color(palette.body)
287 .child(report.reason.clone()),300 .child(report.reason.clone()),
288 )301 )
289 .children(report.body.as_ref().map(|body| {302 .children(report.body.as_ref().map(|body| {
290 div()303 div()
291- .px(px(8.))304+ .px(px(space::SM))
292- .py(px(6.))305+ .py(px(space::SM))
293- .rounded(px(6.))306+ .rounded(px(radius::MD))
294 .bg(palette.window)307 .bg(palette.window)
295- .text_size(text(12.))308+ .text_size(text_fn(text::CAPTION))
296 .text_color(palette.muted)309 .text_color(palette.muted)
297 .line_clamp(2)310 .line_clamp(2)
298 .child(body.clone())311 .child(body.clone())
@@ -303,7 +316,7 @@ impl Yumush {
303 .flex()316 .flex()
304 .flex_wrap()317 .flex_wrap()
305 .items_center()318 .items_center()
306- .gap(px(4.))319+ .gap(px(space::XS))
307 .children(actions)320 .children(actions)
308 }))321 }))
309 }322 }
crates/client/src/gui/builder/storage.rsmodified+23 -22
@@ -18,7 +18,9 @@ use super::ui::{
18 };18 };
19 use crate::gui::{19 use crate::gui::{
20 DATE, Palette, Yumush, community_settings::user_name, entity_action, millis_time, notify_error,20 DATE, Palette, Yumush, community_settings::user_name, entity_action, millis_time, notify_error,
21- storage, text, widget::field,21+ storage,
22+ style::{radius, size, space, text},
23+ text, widget::field,
22 };24 };
23 25
24 fn share(bytes: u64, max: u64) -> f32 {26 fn share(bytes: u64, max: u64) -> f32 {
@@ -31,50 +33,50 @@ fn share(bytes: u64, max: u64) -> f32 {
31 33
32 fn usage_row(name: &str, bytes: u64, count: u64, fraction: f32, palette: Palette) -> Div {34 fn usage_row(name: &str, bytes: u64, count: u64, fraction: f32, palette: Palette) -> Div {
33 div()35 div()
34- .px(px(14.))36+ .px(px(space::LG))
35- .py(px(8.))37+ .py(px(space::SM))
36 .flex()38 .flex()
37 .flex_col()39 .flex_col()
38- .gap(px(6.))40+ .gap(px(space::SM))
39 .child(41 .child(
40 div()42 div()
41 .flex()43 .flex()
42 .items_center()44 .items_center()
43- .gap(px(8.))45+ .gap(px(space::SM))
44 .child(46 .child(
45 div()47 div()
46 .flex_1()48 .flex_1()
47 .min_w_0()49 .min_w_0()
48 .truncate()50 .truncate()
49- .text_size(text(13.))51+ .text_size(text(text::LABEL))
50 .text_color(palette.text)52 .text_color(palette.text)
51 .child(name.to_string()),53 .child(name.to_string()),
52 )54 )
53 .child(55 .child(
54 div()56 div()
55 .flex_shrink_0()57 .flex_shrink_0()
56- .text_size(text(13.))58+ .text_size(text(text::LABEL))
57 .font_weight(FontWeight::MEDIUM)59 .font_weight(FontWeight::MEDIUM)
58 .text_color(palette.text)60 .text_color(palette.text)
59 .child(storage(bytes)),61 .child(storage(bytes)),
60 )62 )
61 .child(63 .child(
62 div()64 div()
63- .w(px(48.))65+ .w(px(size::ROW))
64 .flex_shrink_0()66 .flex_shrink_0()
65 .flex()67 .flex()
66 .justify_end()68 .justify_end()
67- .text_size(text(11.))69+ .text_size(text(text::CAPTION))
68 .text_color(palette.muted)70 .text_color(palette.muted)
69 .child(count.to_string()),71 .child(count.to_string()),
70 ),72 ),
71 )73 )
72 .child(74 .child(
73- div().h(px(3.)).rounded(px(3.)).bg(palette.hover).child(75+ div().h(px(space::XXS)).rounded(px(radius::SM)).bg(palette.hover).child(
74 div()76 div()
75 .h_full()77 .h_full()
76 .w(relative(fraction))78 .w(relative(fraction))
77- .rounded(px(3.))79+ .rounded(px(radius::SM))
78 .bg(palette.accent),80 .bg(palette.accent),
79 ),81 ),
80 )82 )
@@ -99,8 +101,7 @@ fn attachment_row(
99 list_row()101 list_row()
100 .child(102 .child(
101 Icon::new(IconName::File)103 Icon::new(IconName::File)
102- .w(px(16.))104+ .size(px(size::ICON))
103- .h(px(16.))
104 .flex_shrink_0()105 .flex_shrink_0()
105 .text_color(palette.muted),106 .text_color(palette.muted),
106 )107 )
@@ -110,18 +111,18 @@ fn attachment_row(
110 .min_w_0()111 .min_w_0()
111 .flex()112 .flex()
112 .flex_col()113 .flex_col()
113- .gap(px(2.))114+ .gap(px(space::XXS))
114 .child(115 .child(
115 div()116 div()
116 .truncate()117 .truncate()
117- .text_size(text(13.))118+ .text_size(text(text::LABEL))
118 .text_color(palette.text)119 .text_color(palette.text)
119 .child(info.attachment.name.clone()),120 .child(info.attachment.name.clone()),
120 )121 )
121 .child(122 .child(
122 div()123 div()
123 .truncate()124 .truncate()
124- .text_size(text(11.))125+ .text_size(text(text::CAPTION))
125 .text_color(palette.muted)126 .text_color(palette.muted)
126 .child(format!(127 .child(format!(
127 "{} · {} · {}",128 "{} · {} · {}",
@@ -134,7 +135,7 @@ fn attachment_row(
134 .child(135 .child(
135 div()136 div()
136 .flex_shrink_0()137 .flex_shrink_0()
137- .text_size(text(12.))138+ .text_size(text(text::CAPTION))
138 .text_color(palette.muted)139 .text_color(palette.muted)
139 .child(storage(info.attachment.size)),140 .child(storage(info.attachment.size)),
140 )141 )
@@ -188,7 +189,7 @@ impl Yumush {
188 let usage =189 let usage =
189 div()190 div()
190 .flex()191 .flex()
191- .gap(px(20.))192+ .gap(px(space::XL))
192 .child(193 .child(
193 div()194 div()
194 .flex_1()195 .flex_1()
@@ -200,9 +201,9 @@ impl Yumush {
200 ));201 ));
201 202
202 let controls = toolbar(vec![203 let controls = toolbar(vec![
203- fixed(160., field(palette, &self.chat.builder_attachment_user)),204+ fixed(size::THUMB, field(palette, &self.chat.builder_attachment_user)),
204 fixed(205 fixed(
205- 160.,206+ size::THUMB,
206 field(palette, &self.chat.builder_attachment_community),207 field(palette, &self.chat.builder_attachment_community),
207 ),208 ),
208 accent_button(209 accent_button(
@@ -227,10 +228,10 @@ impl Yumush {
227 .collect();228 .collect();
228 let body = if rows.is_empty() {229 let body = if rows.is_empty() {
229 div()230 div()
230- .py(px(24.))231+ .py(px(space::XL))
231 .flex()232 .flex()
232 .justify_center()233 .justify_center()
233- .text_size(text(12.))234+ .text_size(text(text::CAPTION))
234 .text_color(palette.muted)235 .text_color(palette.muted)
235 .child("No attachments")236 .child("No attachments")
236 } else {237 } else {
crates/client/src/gui/builder/ui.rsmodified+55 -54
@@ -1,3 +1,4 @@
1+use crate::gui::style::{radius, size, space, text};
1 use crate::gui::{Palette, Tooltip as _, clickable, primary_button, text, widget};2 use crate::gui::{Palette, Tooltip as _, clickable, primary_button, text, widget};
2 use gpui_kit::{3 use gpui_kit::{
3 AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window,4 AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window,
@@ -5,6 +6,8 @@ use gpui_kit::{
5 };6 };
6 use jiff::{civil::Date, tz::TimeZone};7 use jiff::{civil::Date, tz::TimeZone};
7 8
9+const LABEL_WIDTH: f32 = 88.;
10+
8 pub(super) fn to_bytes(text: &str, unit: u64) -> Option<u64> {11 pub(super) fn to_bytes(text: &str, unit: u64) -> Option<u64> {
9 text.trim().parse::<u64>().ok()?.checked_mul(unit)12 text.trim().parse::<u64>().ok()?.checked_mul(unit)
10 }13 }
@@ -76,16 +79,16 @@ pub(super) fn action_button(
76 ) -> Stateful<Div> {79 ) -> Stateful<Div> {
77 clickable(id, palette, action)80 clickable(id, palette, action)
78 .tip(tip)81 .tip(tip)
79- .h(px(28.))82+ .h(px(size::CONTROL_SM))
80- .px(px(10.))83+ .px(px(space::MD))
81 .flex()84 .flex()
82 .items_center()85 .items_center()
83- .gap(px(6.))86+ .gap(px(space::SM))
84- .rounded(px(6.))87+ .rounded(px(radius::MD))
85- .text_size(text(12.))88+ .text_size(text(text::CAPTION))
86 .font_weight(FontWeight::MEDIUM)89 .font_weight(FontWeight::MEDIUM)
87 .text_color(color)90 .text_color(color)
88- .child(Icon::new(icon).w(px(14.)).h(px(14.)))91+ .child(Icon::new(icon).size(px(size::ICON_SM)))
89 .child(label)92 .child(label)
90 }93 }
91 94
@@ -129,15 +132,15 @@ pub(super) fn action_group(
129 div()132 div()
130 .flex()133 .flex()
131 .items_start()134 .items_start()
132- .gap(px(12.))135+ .gap(px(space::MD))
133 .child(136 .child(
134 div()137 div()
135- .w(px(88.))138+ .w(px(LABEL_WIDTH))
136- .h(px(28.))139+ .h(px(size::CONTROL_SM))
137 .flex_shrink_0()140 .flex_shrink_0()
138 .flex()141 .flex()
139 .items_center()142 .items_center()
140- .text_size(text(11.))143+ .text_size(text(text::CAPTION))
141 .font_weight(FontWeight::MEDIUM)144 .font_weight(FontWeight::MEDIUM)
142 .text_color(palette.muted)145 .text_color(palette.muted)
143 .child(title),146 .child(title),
@@ -148,8 +151,8 @@ pub(super) fn action_group(
148 .min_w_0()151 .min_w_0()
149 .flex()152 .flex()
150 .flex_col()153 .flex_col()
151- .gap(px(4.))154+ .gap(px(space::XS))
152- .child(div().flex().flex_wrap().gap(px(4.)).children(children)),155+ .child(div().flex().flex_wrap().gap(px(space::XS)).children(children)),
153 ),156 ),
154 )157 )
155 }158 }
@@ -161,15 +164,15 @@ pub(super) fn danger_button(
161 action: impl Fn(&mut Window, &mut App) + 'static,164 action: impl Fn(&mut Window, &mut App) + 'static,
162 ) -> impl IntoElement {165 ) -> impl IntoElement {
163 clickable(id, palette, action)166 clickable(id, palette, action)
164- .h(px(28.))167+ .h(px(size::CONTROL_SM))
165- .px(px(12.))168+ .px(px(space::MD))
166 .flex()169 .flex()
167 .items_center()170 .items_center()
168- .rounded(px(6.))171+ .rounded(px(radius::MD))
169- .text_size(text(12.))172+ .text_size(text(text::CAPTION))
170 .font_weight(FontWeight::MEDIUM)173 .font_weight(FontWeight::MEDIUM)
171 .border_1()174 .border_1()
172- .border_color(palette.danger.opacity(0.5))175+ .border_color(palette.border)
173 .text_color(palette.danger)176 .text_color(palette.danger)
174 .child(label)177 .child(label)
175 }178 }
@@ -196,10 +199,10 @@ pub(super) fn end_of_day_ms(text: &str) -> Option<u64> {
196 pub(super) fn rows_body(rows: Vec<Div>, empty: &str, palette: Palette) -> Div {199 pub(super) fn rows_body(rows: Vec<Div>, empty: &str, palette: Palette) -> Div {
197 if rows.is_empty() {200 if rows.is_empty() {
198 return div()201 return div()
199- .py(px(24.))202+ .py(px(space::XL))
200 .flex()203 .flex()
201 .justify_center()204 .justify_center()
202- .text_size(text(12.))205+ .text_size(text(text::CAPTION))
203 .text_color(palette.muted)206 .text_color(palette.muted)
204 .child(empty.to_string());207 .child(empty.to_string());
205 }208 }
@@ -220,12 +223,12 @@ pub(super) fn accent_button(
220 action: impl Fn(&mut Window, &mut App) + 'static,223 action: impl Fn(&mut Window, &mut App) + 'static,
221 ) -> impl IntoElement {224 ) -> impl IntoElement {
222 primary_button(id, palette, action)225 primary_button(id, palette, action)
223- .h(px(28.))226+ .h(px(size::CONTROL_SM))
224- .px(px(12.))227+ .px(px(space::MD))
225 .flex()228 .flex()
226 .items_center()229 .items_center()
227- .rounded(px(6.))230+ .rounded(px(radius::MD))
228- .text_size(text(12.))231+ .text_size(text(text::CAPTION))
229 .font_weight(FontWeight::MEDIUM)232 .font_weight(FontWeight::MEDIUM)
230 .child(label)233 .child(label)
231 }234 }
@@ -237,12 +240,12 @@ pub(super) fn plain_button(
237 action: impl Fn(&mut Window, &mut App) + 'static,240 action: impl Fn(&mut Window, &mut App) + 'static,
238 ) -> impl IntoElement {241 ) -> impl IntoElement {
239 clickable(id, palette, action)242 clickable(id, palette, action)
240- .h(px(28.))243+ .h(px(size::CONTROL_SM))
241- .px(px(12.))244+ .px(px(space::MD))
242 .flex()245 .flex()
243 .items_center()246 .items_center()
244- .rounded(px(6.))247+ .rounded(px(radius::MD))
245- .text_size(text(12.))248+ .text_size(text(text::CAPTION))
246 .font_weight(FontWeight::MEDIUM)249 .font_weight(FontWeight::MEDIUM)
247 .text_color(palette.muted)250 .text_color(palette.muted)
248 .child(label)251 .child(label)
@@ -252,26 +255,24 @@ pub(super) fn card(palette: Palette) -> Div {
252 div()255 div()
253 .flex()256 .flex()
254 .flex_col()257 .flex_col()
255- .rounded(px(10.))258+ .rounded(px(radius::MD))
256- .border_1()
257- .border_color(palette.border)
258 .bg(palette.panel)259 .bg(palette.panel)
259 .overflow_hidden()260 .overflow_hidden()
260 }261 }
261 262
262 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 {
263 div()264 div()
264- .px(px(14.))265+ .px(px(space::LG))
265- .py(px(10.))266+ .py(px(space::MD))
266 .flex()267 .flex()
267 .items_center()268 .items_center()
268 .justify_between()269 .justify_between()
269- .gap(px(8.))270+ .gap(px(space::SM))
270 .border_b_1()271 .border_b_1()
271 .border_color(palette.border)272 .border_color(palette.border)
272 .child(273 .child(
273 div()274 div()
274- .text_size(text(13.))275+ .text_size(text(text::LABEL))
275 .font_weight(FontWeight::MEDIUM)276 .font_weight(FontWeight::MEDIUM)
276 .text_color(palette.text)277 .text_color(palette.text)
277 .child(title.to_string()),278 .child(title.to_string()),
@@ -282,10 +283,10 @@ pub(super) fn card_header(title: &str, actions: Vec<AnyElement>, palette: Palett
282 pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {283 pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {
283 let body = if rows.is_empty() {284 let body = if rows.is_empty() {
284 div()285 div()
285- .py(px(24.))286+ .py(px(space::XL))
286 .flex()287 .flex()
287 .justify_center()288 .justify_center()
288- .text_size(text(12.))289+ .text_size(text(text::CAPTION))
289 .text_color(palette.muted)290 .text_color(palette.muted)
290 .child(empty.to_string())291 .child(empty.to_string())
291 } else {292 } else {
@@ -306,12 +307,12 @@ pub(super) fn list_card(title: Option<&str>, rows: Vec<Div>, empty: &str, palett
306 307
307 pub(super) fn list_row() -> Div {308 pub(super) fn list_row() -> Div {
308 div()309 div()
309- .min_h(px(44.))310+ .min_h(px(size::ROW))
310- .px(px(14.))311+ .px(px(space::LG))
311- .py(px(10.))312+ .py(px(space::MD))
312 .flex()313 .flex()
313 .items_center()314 .items_center()
314- .gap(px(10.))315+ .gap(px(space::MD))
315 }316 }
316 317
317 pub(super) fn toolbar(items: Vec<AnyElement>) -> Div {318 pub(super) fn toolbar(items: Vec<AnyElement>) -> Div {
@@ -319,24 +320,24 @@ pub(super) fn toolbar(items: Vec<AnyElement>) -> Div {
319 .flex()320 .flex()
320 .flex_wrap()321 .flex_wrap()
321 .items_center()322 .items_center()
322- .gap(px(8.))323+ .gap(px(space::SM))
323 .children(items)324 .children(items)
324 }325 }
325 326
326 pub(super) fn stat_tile(label: &str, value: &str, palette: Palette) -> Div {327 pub(super) fn stat_tile(label: &str, value: &str, palette: Palette) -> Div {
327 card(palette)328 card(palette)
328- .p(px(14.))329+ .p(px(space::LG))
329- .gap(px(4.))330+ .gap(px(space::XS))
330 .child(331 .child(
331 div()332 div()
332- .text_size(text(22.))333+ .text_size(text(text::TITLE))
333 .font_weight(FontWeight::SEMIBOLD)334 .font_weight(FontWeight::SEMIBOLD)
334 .text_color(palette.text)335 .text_color(palette.text)
335 .child(value.to_string()),336 .child(value.to_string()),
336 )337 )
337 .child(338 .child(
338 div()339 div()
339- .text_size(text(12.))340+ .text_size(text(text::CAPTION))
340 .text_color(palette.muted)341 .text_color(palette.muted)
341 .child(label.to_string()),342 .child(label.to_string()),
342 )343 )
@@ -358,27 +359,27 @@ pub(super) fn field_row(
358 .flex_col()359 .flex_col()
359 .child(360 .child(
360 div()361 div()
361- .text_size(text(13.))362+ .text_size(text(text::LABEL))
362 .text_color(palette.text)363 .text_color(palette.text)
363 .child(label.to_string()),364 .child(label.to_string()),
364 )365 )
365 .children(hint.map(|hint| {366 .children(hint.map(|hint| {
366 div()367 div()
367- .text_size(text(11.))368+ .text_size(text(text::CAPTION))
368 .text_color(palette.muted)369 .text_color(palette.muted)
369 .child(hint.to_string())370 .child(hint.to_string())
370 })),371 })),
371 )372 )
372- .child(div().w(px(220.)).flex_shrink_0().child(control))373+ .child(div().w(px(size::SIDEBAR)).flex_shrink_0().child(control))
373 }374 }
374 375
375 pub(super) fn pill(label: &str, color: Hsla, palette: Palette) -> Div {376 pub(super) fn pill(label: &str, color: Hsla, palette: Palette) -> Div {
376 div()377 div()
377- .px(px(6.))378+ .px(px(space::SM))
378- .py(px(1.))379+ .py(px(space::XXS))
379- .rounded(px(4.))380+ .rounded(px(radius::SM))
380 .bg(palette.hover)381 .bg(palette.hover)
381- .text_size(text(11.))382+ .text_size(text(text::CAPTION))
382 .text_color(color)383 .text_color(color)
383 .child(label.to_string())384 .child(label.to_string())
384 }385 }
@@ -388,10 +389,10 @@ pub(super) fn page_heading(title: &str, actions: Vec<AnyElement>, palette: Palet
388 .flex()389 .flex()
389 .items_center()390 .items_center()
390 .justify_between()391 .justify_between()
391- .gap(px(8.))392+ .gap(px(space::SM))
392 .child(393 .child(
393 div()394 div()
394- .text_size(text(20.))395+ .text_size(text(text::TITLE))
395 .font_weight(FontWeight::SEMIBOLD)396 .font_weight(FontWeight::SEMIBOLD)
396 .text_color(palette.text)397 .text_color(palette.text)
397 .child(title.to_string()),398 .child(title.to_string()),
crates/client/src/gui/builder/users.rsmodified+40 -40
@@ -28,6 +28,7 @@ use crate::{
28 notify_error,28 notify_error,
29 profile::user_link,29 profile::user_link,
30 text,30 text,
31+ style::{radius, size, space, text},
31 widget::{field, search_text},32 widget::{field, search_text},
32 },33 },
33 net::{Fail, NetworkHandle},34 net::{Fail, NetworkHandle},
@@ -422,30 +423,30 @@ impl Yumush {
422 };423 };
423 424
424 let toolbar = div()425 let toolbar = div()
425- .px(px(14.))426+ .px(px(space::LG))
426- .py(px(10.))427+ .py(px(space::MD))
427 .flex()428 .flex()
428 .flex_wrap()429 .flex_wrap()
429 .items_center()430 .items_center()
430- .gap(px(8.))431+ .gap(px(space::SM))
431 .border_b_1()432 .border_b_1()
432 .border_color(palette.border)433 .border_color(palette.border)
433 .child(434 .child(
434 div()435 div()
435 .flex_1()436 .flex_1()
436- .min_w(px(160.))437+ .min_w(px(size::THUMB))
437 .child(Input::new(&self.chat.builder_search)),438 .child(Input::new(&self.chat.builder_search)),
438 )439 )
439 .child(440 .child(
440 div()441 div()
441 .flex_1()442 .flex_1()
442- .min_w(px(120.))443+ .min_w(px(size::THUMB))
443 .child(field(palette, &self.chat.new_username)),444 .child(field(palette, &self.chat.new_username)),
444 )445 )
445 .child(446 .child(
446 div()447 div()
447 .flex_1()448 .flex_1()
448- .min_w(px(120.))449+ .min_w(px(size::THUMB))
449 .child(field(palette, &self.chat.new_password)),450 .child(field(palette, &self.chat.new_password)),
450 )451 )
451 .child(accent_button(452 .child(accent_button(
@@ -459,10 +460,10 @@ impl Yumush {
459 460
460 let body = if rows.is_empty() {461 let body = if rows.is_empty() {
461 div()462 div()
462- .py(px(24.))463+ .py(px(space::XL))
463 .flex()464 .flex()
464 .justify_center()465 .justify_center()
465- .text_size(text(12.))466+ .text_size(text(text::CAPTION))
466 .text_color(palette.muted)467 .text_color(palette.muted)
467 .child("No users".to_string())468 .child("No users".to_string())
468 } else {469 } else {
@@ -486,11 +487,11 @@ impl Yumush {
486 palette: Palette,487 palette: Palette,
487 ) -> Div {488 ) -> Div {
488 div()489 div()
489- .h(px(40.))490+ .h(px(size::ROW))
490- .px(px(12.))491+ .px(px(space::MD))
491 .flex()492 .flex()
492 .items_center()493 .items_center()
493- .gap(px(8.))494+ .gap(px(space::SM))
494 .child(495 .child(
495 div()496 div()
496 .flex_1()497 .flex_1()
@@ -520,11 +521,11 @@ impl Yumush {
520 };521 };
521 522
522 div()523 div()
523- .h(px(40.))524+ .h(px(size::ROW))
524- .px(px(12.))525+ .px(px(space::MD))
525 .flex()526 .flex()
526 .items_center()527 .items_center()
527- .gap(px(8.))528+ .gap(px(space::SM))
528 .child(529 .child(
529 div()530 div()
530 .flex_1()531 .flex_1()
@@ -575,20 +576,19 @@ impl Yumush {
575 576
576 div()577 div()
577 .w_full()578 .w_full()
578- .h(px(28.))579+ .h(px(size::CONTROL_SM))
579 .flex()580 .flex()
580 .items_center()581 .items_center()
581- .gap(px(8.))582+ .gap(px(space::SM))
582 .child(583 .child(
583 Icon::new(IconName::Monitor)584 Icon::new(IconName::Monitor)
584- .w(px(14.))585+ .size(px(size::ICON_SM))
585- .h(px(14.))
586 .text_color(palette.muted),586 .text_color(palette.muted),
587 )587 )
588 .child(588 .child(
589 div()589 div()
590 .flex_1()590 .flex_1()
591- .text_size(text(12.))591+ .text_size(text(text::CAPTION))
592 .min_w_0()592 .min_w_0()
593 .truncate()593 .truncate()
594 .child(device.to_string()),594 .child(device.to_string()),
@@ -596,7 +596,7 @@ impl Yumush {
596 .child(596 .child(
597 div()597 div()
598 .flex_shrink_0()598 .flex_shrink_0()
599- .text_size(text(11.))599+ .text_size(text(text::CAPTION))
600 .text_color(palette.muted)600 .text_color(palette.muted)
601 .child(seen_text(session.last_seen)),601 .child(seen_text(session.last_seen)),
602 )602 )
@@ -610,11 +610,11 @@ impl Yumush {
610 palette: Palette,610 palette: Palette,
611 ) -> Div {611 ) -> Div {
612 div()612 div()
613- .h(px(40.))613+ .h(px(size::ROW))
614- .px(px(12.))614+ .px(px(space::MD))
615 .flex()615 .flex()
616 .items_center()616 .items_center()
617- .gap(px(8.))617+ .gap(px(space::SM))
618 .child(618 .child(
619 div()619 div()
620 .flex_1()620 .flex_1()
@@ -638,11 +638,11 @@ impl Yumush {
638 palette: Palette,638 palette: Palette,
639 ) -> Div {639 ) -> Div {
640 div()640 div()
641- .h(px(40.))641+ .h(px(size::ROW))
642- .px(px(12.))642+ .px(px(space::MD))
643 .flex()643 .flex()
644 .items_center()644 .items_center()
645- .gap(px(8.))645+ .gap(px(space::SM))
646 .child(646 .child(
647 div()647 div()
648 .flex_1()648 .flex_1()
@@ -774,15 +774,15 @@ impl Yumush {
774 }),774 }),
775 )775 )
776 .tip("Manage")776 .tip("Manage")
777- .size(px(28.))777+ .size(px(size::CONTROL_SM))
778 .flex_shrink_0()778 .flex_shrink_0()
779 .flex()779 .flex()
780 .items_center()780 .items_center()
781 .justify_center()781 .justify_center()
782- .rounded(px(6.))782+ .rounded(px(radius::MD))
783 .text_color(palette.muted)783 .text_color(palette.muted)
784 .when(expanded, |this| this.bg(palette.hover))784 .when(expanded, |this| this.bg(palette.hover))
785- .child(Icon::new(IconName::Ellipsis).w(px(16.)).h(px(16.)));785+ .child(Icon::new(IconName::Ellipsis).size(px(size::ICON)));
786 786
787 let rename_button = action_button(787 let rename_button = action_button(
788 format!("rename_user_{}", user.id),788 format!("rename_user_{}", user.id),
@@ -857,16 +857,16 @@ impl Yumush {
857 );857 );
858 858
859 let row = div()859 let row = div()
860- .px(px(14.))860+ .px(px(space::LG))
861- .py(px(10.))861+ .py(px(space::MD))
862 .flex()862 .flex()
863 .items_center()863 .items_center()
864- .gap(px(10.))864+ .gap(px(space::MD))
865 .child(user_link(865 .child(user_link(
866 format!("builder_user_avatar_{}", user.id),866 format!("builder_user_avatar_{}", user.id),
867 Some(user),867 Some(user),
868 entity,868 entity,
869- avatar(palette, user, px(28.), text(11.), &self.chat.avatars),869+ avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),
870 ))870 ))
871 .child(871 .child(
872 div()872 div()
@@ -874,20 +874,20 @@ impl Yumush {
874 .min_w_0()874 .min_w_0()
875 .flex()875 .flex()
876 .flex_col()876 .flex_col()
877- .gap(px(2.))877+ .gap(px(space::XXS))
878 .child(878 .child(
879 div()879 div()
880 .min_w_0()880 .min_w_0()
881 .flex()881 .flex()
882 .items_center()882 .items_center()
883- .gap(px(6.))883+ .gap(px(space::SM))
884 .child(user_link(884 .child(user_link(
885 format!("builder_user_name_{}", user.id),885 format!("builder_user_name_{}", user.id),
886 Some(user),886 Some(user),
887 entity,887 entity,
888 div()888 div()
889 .truncate()889 .truncate()
890- .text_size(text(13.))890+ .text_size(text(text::LABEL))
891 .font_weight(FontWeight::MEDIUM)891 .font_weight(FontWeight::MEDIUM)
892 .text_color(palette.text)892 .text_color(palette.text)
893 .child(user.username.clone()),893 .child(user.username.clone()),
@@ -909,7 +909,7 @@ impl Yumush {
909 div()909 div()
910 .min_w_0()910 .min_w_0()
911 .truncate()911 .truncate()
912- .text_size(text(11.))912+ .text_size(text(text::CAPTION))
913 .text_color(palette.muted)913 .text_color(palette.muted)
914 .child(format!("joined {joined} · seen {seen}")),914 .child(format!("joined {joined} · seen {seen}")),
915 ),915 ),
@@ -950,9 +950,9 @@ impl Yumush {
950 div()950 div()
951 .flex()951 .flex()
952 .flex_col()952 .flex_col()
953- .gap(px(8.))953+ .gap(px(space::SM))
954- .px(px(14.))954+ .px(px(space::LG))
955- .py(px(10.))955+ .py(px(space::MD))
956 .bg(palette.window)956 .bg(palette.window)
957 .border_t_1()957 .border_t_1()
958 .border_color(palette.border)958 .border_color(palette.border)
crates/client/src/gui/builder/voice.rsmodified+13 -9
@@ -12,7 +12,11 @@ use gpui_kit::{
12 12
13 use super::ui::{card, card_header, icon_button, list_card, pill, rows_body};13 use super::ui::{card, card_header, icon_button, list_card, pill, rows_body};
14 use crate::{14 use crate::{
15- gui::{Palette, Yumush, avatar, entity_action, notify_error, profile::user_link, text},15+ gui::{
16+ Palette, Yumush, avatar, entity_action, notify_error, profile::user_link,
17+ style::{self, size, space},
18+ text,
19+ },
16 net::{Fail, NetworkHandle},20 net::{Fail, NetworkHandle},
17 };21 };
18 22
@@ -173,12 +177,12 @@ impl Yumush {
173 let kick_id = id;177 let kick_id = id;
174 178
175 div()179 div()
176- .min_h(px(44.))180+ .min_h(px(size::ROW))
177- .px(px(14.))181+ .px(px(space::LG))
178- .py(px(8.))182+ .py(px(space::SM))
179 .flex()183 .flex()
180 .items_center()184 .items_center()
181- .gap(px(10.))185+ .gap(px(space::MD))
182 .child(186 .child(
183 div().flex_1().min_w_0().flex().child(user_link(187 div().flex_1().min_w_0().flex().child(user_link(
184 format!("voice_user_{id}"),188 format!("voice_user_{id}"),
@@ -187,19 +191,19 @@ impl Yumush {
187 div()191 div()
188 .flex()192 .flex()
189 .items_center()193 .items_center()
190- .gap(px(10.))194+ .gap(px(space::MD))
191 .child(avatar(195 .child(avatar(
192 palette,196 palette,
193 user,197 user,
194- px(24.),198+ px(size::AVATAR),
195- text(10.),199+ text(style::text::CAPTION),
196 &self.chat.avatars,200 &self.chat.avatars,
197 ))201 ))
198 .child(202 .child(
199 div()203 div()
200 .min_w_0()204 .min_w_0()
201 .truncate()205 .truncate()
202- .text_size(text(13.))206+ .text_size(text(style::text::LABEL))
203 .text_color(palette.text)207 .text_color(palette.text)
204 .child(user.username.clone()),208 .child(user.username.clone()),
205 ),209 ),
crates/client/src/gui/camera_view.rsmodified+71 -36
@@ -6,18 +6,24 @@ use common::share::{Fps, Kind, Quality, Resolution};
6 use gpui_kit::{6 use gpui_kit::{
7 AnyElement, AppContext as _, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement,7 AnyElement, AppContext as _, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement,
8 ParentElement, StatefulInteractiveElement, Styled, Task, Window, assets::IconName,8 ParentElement, StatefulInteractiveElement, Styled, Task, Window, assets::IconName,
9- component::Icon, div, px,9+ component::Icon, div, px, transparent_black,
10 };10 };
11 11
12 use super::{12 use super::{
13 Palette, Tooltip as _, Yumush, avatar, clickable, media_view::into_render_image, notify_error,13 Palette, Tooltip as _, Yumush, avatar, clickable, media_view::into_render_image, notify_error,
14- share_view, surface::Surface, text, wave::mini_wave, widget::spawn_warn,14+ share_view,
15+ style::{radius, size, space, text},
16+ parts::{Voice, caption, voice_line},
17+ surface::Surface, text, wave::mini_wave, widget::spawn_warn,
15 };18 };
16 use crate::share::session::WatchQuality;19 use crate::share::session::WatchQuality;
17 20
18 const IDLE_TICK: Duration = Duration::from_millis(250);21 const IDLE_TICK: Duration = Duration::from_millis(250);
19 const FRAME_TICK: Duration = Duration::from_millis(16);22 const FRAME_TICK: Duration = Duration::from_millis(16);
20 const PUMP_STALL: Duration = Duration::from_millis(50);23 const PUMP_STALL: Duration = Duration::from_millis(50);
24+const STRIP_H: f32 = 206.;
25+const TILE_W: f32 = 338.;
26+const TILE_H: f32 = 190.;
21 27
22 pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality {28 pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality {
23 resolution: Resolution::P360,29 resolution: Resolution::P360,
@@ -215,23 +221,56 @@ impl Yumush {
215 .into_iter()221 .into_iter()
216 .map(|source| stage_tile(entity, self, palette, source))222 .map(|source| stage_tile(entity, self, palette, source))
217 .collect();223 .collect();
224+ if tiles.is_empty() {
225+ return Some(self.voices(palette).into_any_element());
226+ }
218 227
219 Some(228 Some(
220 div()229 div()
221 .id("stage_strip")230 .id("stage_strip")
222 .flex()231 .flex()
223 .flex_shrink_0()232 .flex_shrink_0()
224- .h(px(206.))233+ .h(px(STRIP_H))
225- .gap(px(8.))234+ .gap(px(space::SM))
226- .p(px(8.))235+ .p(px(space::SM))
227 .bg(palette.window)236 .bg(palette.window)
228 .overflow_x_scroll()237 .overflow_x_scroll()
229 .border_b_1()238 .border_b_1()
230 .border_color(palette.border)239 .border_color(palette.border)
231- .children(tiles),240+ .children(tiles)
241+ .into_any_element(),
232 )242 )
233 }243 }
234 244
245+ fn voices(&self, palette: Palette) -> Div {
246+ let t = palette.tokens;
247+ let people = self
248+ .chat
249+ .voice_community()
250+ .map(|community_id| self.chat.voice_ids(community_id))
251+ .unwrap_or_default()
252+ .into_iter()
253+ .filter_map(|id| self.chat.author(*id))
254+ .map(|user| {
255+ let speaking = self.chat.waves.speaking.contains(&user.id);
256+ let voice = if speaking {
257+ Voice::Live(t.person(user.id))
258+ } else {
259+ Voice::Quiet
260+ };
261+ caption(user.username.clone(), voice_line(self.chat.waves.voice(user.id), voice, t), t)
262+ .w(px(size::TALK))
263+ });
264+ div()
265+ .flex()
266+ .flex_col()
267+ .flex_shrink_0()
268+ .gap(px(space::MD))
269+ .px(px(space::XL))
270+ .py(px(space::XL))
271+ .children(people)
272+ }
273+
235 pub(super) fn stage_grid(274 pub(super) fn stage_grid(
236 &self,275 &self,
237 entity: &Entity<Self>,276 entity: &Entity<Self>,
@@ -273,17 +312,17 @@ impl Yumush {
273 .relative()312 .relative()
274 .flex_1()313 .flex_1()
275 .min_h_0()314 .min_h_0()
276- .p(px(8.))315+ .p(px(space::SM))
277 .bg(palette.window)316 .bg(palette.window)
278 .flex()317 .flex()
279 .flex_col()318 .flex_col()
280- .gap(px(8.))319+ .gap(px(space::SM))
281 .children((0..rows).map(|_| {320 .children((0..rows).map(|_| {
282 div()321 div()
283 .flex_1()322 .flex_1()
284 .min_h_0()323 .min_h_0()
285 .flex()324 .flex()
286- .gap(px(8.))325+ .gap(px(space::SM))
287 .children((0..columns).map(|_| {326 .children((0..columns).map(|_| {
288 cells327 cells
289 .next()328 .next()
@@ -368,8 +407,8 @@ fn stage_tile(
368 .child(avatar(407 .child(avatar(
369 palette,408 palette,
370 user,409 user,
371- px(56.),410+ px(size::AVATAR_LG),
372- text(20.),411+ text(text::TITLE),
373 &yumush.chat.avatars,412 &yumush.chat.avatars,
374 ))413 ))
375 .into_any_element(),414 .into_any_element(),
@@ -388,9 +427,9 @@ fn stage_tile(
388 .tip("Watch")427 .tip("Watch")
389 .relative()428 .relative()
390 .flex_shrink_0()429 .flex_shrink_0()
391- .w(px(338.))430+ .w(px(TILE_W))
392- .h(px(190.))431+ .h(px(TILE_H))
393- .rounded(px(10.))432+ .rounded(px(radius::MD))
394 .overflow_hidden()433 .overflow_hidden()
395 .bg(gpui_kit::black())434 .bg(gpui_kit::black())
396 .border_2()435 .border_2()
@@ -399,14 +438,14 @@ fn stage_tile(
399 } else if speaking {438 } else if speaking {
400 palette.ok439 palette.ok
401 } else {440 } else {
402- palette.ok.opacity(0.)441+ transparent_black()
403 })442 })
404 .child(content)443 .child(content)
405 .child(444 .child(
406 tile_label(yumush, palette, (user_id, kind))445 tile_label(yumush, palette, (user_id, kind))
407 .absolute()446 .absolute()
408- .left(px(8.))447+ .left(px(space::SM))
409- .bottom(px(8.)),448+ .bottom(px(space::SM)),
410 )449 )
411 }450 }
412 451
@@ -435,8 +474,8 @@ fn grid_cell(
435 .child(avatar(474 .child(avatar(
436 palette,475 palette,
437 user,476 user,
438- px(64.),477+ px(size::AVATAR_LG),
439- text(24.),478+ text(text::TITLE),
440 &yumush.chat.avatars,479 &yumush.chat.avatars,
441 ))480 ))
442 .into_any_element(),481 .into_any_element(),
@@ -449,21 +488,21 @@ fn grid_cell(
449 .flex_1()488 .flex_1()
450 .min_w_0()489 .min_w_0()
451 .min_h_0()490 .min_h_0()
452- .rounded(px(10.))491+ .rounded(px(radius::MD))
453 .overflow_hidden()492 .overflow_hidden()
454 .bg(gpui_kit::black())493 .bg(gpui_kit::black())
455 .border_2()494 .border_2()
456 .border_color(if speaking {495 .border_color(if speaking {
457 palette.ok496 palette.ok
458 } else {497 } else {
459- palette.ok.opacity(0.)498+ transparent_black()
460 })499 })
461 .child(content)500 .child(content)
462 .child(501 .child(
463 tile_label(yumush, palette, (user_id, kind))502 tile_label(yumush, palette, (user_id, kind))
464 .absolute()503 .absolute()
465- .left(px(8.))504+ .left(px(space::SM))
466- .bottom(px(8.)),505+ .bottom(px(space::SM)),
467 );506 );
468 507
469 if shared {508 if shared {
@@ -506,33 +545,29 @@ pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, kind): (Id
506 || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted));545 || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted));
507 546
508 div()547 div()
509- .h(px(24.))548+ .h(px(size::CONTROL_SM))
510- .px(px(8.))549+ .px(px(space::SM))
511- .rounded(px(12.))550+ .rounded(px(radius::LG))
512- .bg(gpui_kit::black().opacity(0.72))551+ .bg(gpui_kit::black())
513- .border_1()
514- .border_color(palette.tinted(user_id).opacity(0.7))
515 .flex()552 .flex()
516 .items_center()553 .items_center()
517- .gap(px(6.))554+ .gap(px(space::SM))
518- .text_size(text(12.))555+ .text_size(text(text::CAPTION))
519 .children(shared.then(|| {556 .children(shared.then(|| {
520 Icon::new(share_view::kind_icon(kind))557 Icon::new(share_view::kind_icon(kind))
521- .w(px(13.))558+ .size(px(size::ICON_SM))
522- .h(px(13.))
523 .text_color(tone)559 .text_color(tone)
524 }))560 }))
525 .child(561 .child(
526 div()562 div()
527 .font_weight(FontWeight::MEDIUM)563 .font_weight(FontWeight::MEDIUM)
528- .text_color(gpui_kit::white().opacity(0.95))564+ .text_color(gpui_kit::white())
529 .child(name.to_string()),565 .child(name.to_string()),
530 )566 )
531 .children(wave.map(|history| mini_wave(history, 10., palette.ok)))567 .children(wave.map(|history| mini_wave(history, 10., palette.ok)))
532 .children((muted && wave.is_none()).then(|| {568 .children((muted && wave.is_none()).then(|| {
533 Icon::new(IconName::MicOff)569 Icon::new(IconName::MicOff)
534- .w(px(12.))570+ .size(px(size::ICON_SM))
535- .h(px(12.))
536 .text_color(palette.danger)571 .text_color(palette.danger)
537 }))572 }))
538 }573 }
crates/client/src/gui/chat.rsmodified+189 -209
@@ -1,3 +1,4 @@
1+use super::style::{radius, size, space, stroke, text};
1 use super::text;2 use super::text;
2 use crate::gui::CLOCK;3 use crate::gui::CLOCK;
3 use std::{4 use std::{
@@ -11,7 +12,7 @@ use crate::gui::social::InviteLookup;
11 use crate::gui::voice_stats::{self, SAMPLE_HISTORY};12 use crate::gui::voice_stats::{self, SAMPLE_HISTORY};
12 use crate::gui::wave::Waves;13 use crate::gui::wave::Waves;
13 use crate::gui::{14 use crate::gui::{
14- FIND_HINT, Palette, Tooltip as _, Yumush, avatar, badge,15+ FIND_HINT, Palette, Tooltip as _, Yumush, avatar,
15 builder::{BuilderTab, Transfer},16 builder::{BuilderTab, Transfer},
16 clickable, community_name,17 clickable, community_name,
17 community_settings::{BanSort, LogSort},18 community_settings::{BanSort, LogSort},
@@ -1226,15 +1227,15 @@ fn empty_state(palette: Palette) -> impl IntoElement {
1226 .flex()1227 .flex()
1227 .items_center()1228 .items_center()
1228 .justify_center()1229 .justify_center()
1229- .gap(px(8.))1230+ .gap(px(space::SM))
1230 .text_color(palette.muted)1231 .text_color(palette.muted)
1231 .child(1232 .child(
1232 div()1233 div()
1233- .px(px(5.))1234+ .px(px(space::XS))
1234- .rounded(px(4.))1235+ .rounded(px(radius::SM))
1235 .border_1()1236 .border_1()
1236 .border_color(palette.border)1237 .border_color(palette.border)
1237- .text_size(text(11.))1238+ .text_size(text(text::CAPTION))
1238 .child(FIND_HINT),1239 .child(FIND_HINT),
1239 )1240 )
1240 .child("Find a user")1241 .child("Find a user")
@@ -1266,7 +1267,6 @@ pub(super) fn create_community(
1266 struct MembersTrigger {1267 struct MembersTrigger {
1267 palette: Palette,1268 palette: Palette,
1268 members: Vec<User>,1269 members: Vec<User>,
1269- avatars: HashMap<Id, Arc<Image>>,
1270 }1270 }
1271 1271
1272 impl Selectable for MembersTrigger {1272 impl Selectable for MembersTrigger {
@@ -1282,31 +1282,19 @@ impl Selectable for MembersTrigger {
1282 impl RenderOnce for MembersTrigger {1282 impl RenderOnce for MembersTrigger {
1283 fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {1283 fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {
1284 let palette = self.palette;1284 let palette = self.palette;
1285- let avatars = self
1286- .members
1287- .iter()
1288- .take(3)
1289- .enumerate()
1290- .map(|(index, user)| {
1291- avatar(palette, user, px(18.), text(9.), &self.avatars)
1292- .border_2()
1293- .border_color(palette.panel)
1294- .when(index > 0, |this| this.ml(px(-6.)))
1295- });
1296 1285
1297 hoverable(1286 hoverable(
1298 "members_trigger",1287 "members_trigger",
1299 div()1288 div()
1300- .h(px(28.))1289+ .h(px(size::CONTROL_SM))
1301- .px(px(8.))1290+ .px(px(space::SM))
1302 .flex()1291 .flex()
1303 .items_center()1292 .items_center()
1304- .gap(px(6.))1293+ .gap(px(space::SM))
1305- .rounded(px(6.))1294+ .rounded(px(radius::MD))
1306- .text_size(text(12.))1295+ .text_size(text(text::LABEL))
1307 .text_color(palette.muted)1296 .text_color(palette.muted)
1308- .child(div().flex().children(avatars))1297+ .child(format!("{} people", self.members.len())),
1309- .child(self.members.len().to_string()),
1310 palette,1298 palette,
1311 )1299 )
1312 }1300 }
@@ -1332,15 +1320,9 @@ impl Yumush {
1332 div()1320 div()
1333 .flex_1()1321 .flex_1()
1334 .min_w_0()1322 .min_w_0()
1335- .mt(px(8.))
1336- .mr(px(8.))
1337- .mb(px(8.))
1338 .flex()1323 .flex()
1339 .flex_col()1324 .flex_col()
1340- .rounded(px(10.))1325+ .bg(palette.window)
1341- .border_1()
1342- .border_color(palette.border)
1343- .bg(palette.panel)
1344 .overflow_hidden()1326 .overflow_hidden()
1345 .children(self.announcement_banner(entity, palette))1327 .children(self.announcement_banner(entity, palette))
1346 .children(self.call_banner(entity, palette))1328 .children(self.call_banner(entity, palette))
@@ -1368,7 +1350,7 @@ impl Yumush {
1368 Some(grid) => panel.child(grid),1350 Some(grid) => panel.child(grid),
1369 None => panel1351 None => panel
1370 .child(self.message_area(entity, themed))1352 .child(self.message_area(entity, themed))
1371- .child(self.composer(entity, themed)),1353+ .child(self.composer(entity, themed, cx)),
1372 },1354 },
1373 }1355 }
1374 }))1356 }))
@@ -1384,9 +1366,9 @@ impl Yumush {
1384 (self.chat.stats_open && self.in_stage_chat()).then(|| {1366 (self.chat.stats_open && self.in_stage_chat()).then(|| {
1385 div()1367 div()
1386 .id("stats_side")1368 .id("stats_side")
1387- .w(px(380.))1369+ .w(px(size::SHEET))
1388 .flex_shrink_0()1370 .flex_shrink_0()
1389- .p(px(10.))1371+ .p(px(space::MD))
1390 .border_l_1()1372 .border_l_1()
1391 .border_color(palette.border)1373 .border_color(palette.border)
1392 .overflow_y_scroll()1374 .overflow_y_scroll()
@@ -1416,23 +1398,12 @@ impl Yumush {
1416 community.is_some_and(|community| matches!(community.kind, CommunityKind::Group));1398 community.is_some_and(|community| matches!(community.kind, CommunityKind::Group));
1417 1399
1418 div()1400 div()
1419- .h(px(44.))1401+ .h(px(size::ROW + space::MD))
1420- .pl(px(20.))1402+ .px(px(space::XL))
1421- .pr(px(12.))
1422 .flex()1403 .flex()
1423 .items_center()1404 .items_center()
1424- .gap(px(8.))1405+ .gap(px(space::SM))
1425- .border_b_2()1406+ .child(super::parts::words(name.to_string(), super::parts::Text::Title, super::parts::Ink::Paper, palette.tokens))
1426- .border_color(palette.accent)
1427- .children(
1428- community
1429- .map(|community| self.community_badge(community, px(20.), text(10.), palette)),
1430- )
1431- .child(
1432- div()
1433- .font_weight(FontWeight::SEMIBOLD)
1434- .child(name.to_string()),
1435- )
1436 .child(div().flex_1())1407 .child(div().flex_1())
1437 .children(1408 .children(
1438 community1409 community
@@ -1461,6 +1432,15 @@ impl Yumush {
1461 .flex_1()1432 .flex_1()
1462 .min_h_0()1433 .min_h_0()
1463 .relative()1434 .relative()
1435+ .child(
1436+ div()
1437+ .absolute()
1438+ .left(px(space::XL))
1439+ .top_0()
1440+ .bottom_0()
1441+ .w(px(stroke::LINE))
1442+ .bg(palette.border),
1443+ )
1464 .child(self.message_list(entity, palette))1444 .child(self.message_list(entity, palette))
1465 .children(self.jump_bottom(entity, palette))1445 .children(self.jump_bottom(entity, palette))
1466 }1446 }
@@ -1476,7 +1456,7 @@ impl Yumush {
1476 .child(1456 .child(
1477 div()1457 div()
1478 .flex()1458 .flex()
1479- .gap(px(8.))1459+ .gap(px(space::SM))
1480 .child(1460 .child(
1481 clickable(1461 clickable(
1482 "jump_unread",1462 "jump_unread",
@@ -1517,22 +1497,22 @@ impl Yumush {
1517 }),1497 }),
1518 )1498 )
1519 .absolute()1499 .absolute()
1520- .right(px(16.))1500+ .right(px(space::LG))
1521- .bottom(px(12.))1501+ .bottom(px(space::MD))
1522- .size(px(36.))1502+ .size(px(size::CONTROL))
1523 .flex()1503 .flex()
1524 .items_center()1504 .items_center()
1525 .justify_center()1505 .justify_center()
1526 .rounded_full()1506 .rounded_full()
1527 .border_1()1507 .border_1()
1528 .border_color(palette.border)1508 .border_color(palette.border)
1529- .bg(palette.panel)1509+ .bg(palette.window)
1530- .child(Icon::new(IconName::ArrowDown).w(px(16.)).h(px(16.)))1510+ .child(Icon::new(IconName::ArrowDown).size(px(size::ICON)))
1531 .children((unseen > 0).then(|| {1511 .children((unseen > 0).then(|| {
1532 div()1512 div()
1533 .absolute()1513 .absolute()
1534- .top(px(-6.))1514+ .top(px(-space::SM))
1535- .right(px(-6.))1515+ .right(px(-space::SM))
1536 .children(unread_badge(1516 .children(unread_badge(
1537 palette,1517 palette,
1538 false,1518 false,
@@ -1558,9 +1538,10 @@ impl Yumush {
1558 .flex_1()1538 .flex_1()
1559 .min_w_0()1539 .min_w_0()
1560 .overflow_y_scroll()1540 .overflow_y_scroll()
1561- .px(px(24.))1541+ .pl(px(space::XL + space::LG))
1562- .py(px(20.))1542+ .pr(px(space::XL))
1563- .gap(px(2.))1543+ .py(px(space::LG))
1544+ .gap(px(space::XXS))
1564 .on_scroll(move |_, window, _| {1545 .on_scroll(move |_, window, _| {
1565 let entity = entity_scroll.clone();1546 let entity = entity_scroll.clone();
1566 window.on_next_frame(move |_, cx| {1547 window.on_next_frame(move |_, cx| {
@@ -1578,8 +1559,10 @@ impl Yumush {
1578 .iter()1559 .iter()
1579 .enumerate()1560 .enumerate()
1580 .map(|(index, message)| {1561 .map(|(index, message)| {
1581- let first =1562+ let first = index == 0 || {
1582- index == 0 || self.chat.messages[index - 1].user_id != message.user_id;1563+ let previous = &self.chat.messages[index - 1];
1564+ previous.user_id != message.user_id || previous.call.is_some()
1565+ };
1583 let row = render_message(1566 let row = render_message(
1584 message,1567 message,
1585 first,1568 first,
@@ -1603,10 +1586,10 @@ impl Yumush {
1603 )1586 )
1604 }1587 }
1605 1588
1606- fn composer(&self, entity: &Entity<Self>, palette: Palette) -> AnyElement {1589+ fn composer(&self, entity: &Entity<Self>, palette: Palette, cx: &App) -> AnyElement {
1607 if let Composer::Select { ids } = &self.chat.composer {1590 if let Composer::Select { ids } = &self.chat.composer {
1608 return div()1591 return div()
1609- .p(px(16.))1592+ .p(px(space::LG))
1610 .child(composer::selection_bar(ids, entity, palette))1593 .child(composer::selection_bar(ids, entity, palette))
1611 .into_any_element();1594 .into_any_element();
1612 }1595 }
@@ -1621,7 +1604,7 @@ impl Yumush {
1621 } = &self.chat.media.voice_note1604 } = &self.chat.media.voice_note
1622 {1605 {
1623 return div()1606 return div()
1624- .p(px(16.))1607+ .p(px(space::LG))
1625 .children(pending)1608 .children(pending)
1626 .child(voice_note::recording_row(1609 .child(voice_note::recording_row(
1627 *started, levels, &entity, palette,1610 *started, levels, &entity, palette,
@@ -1629,52 +1612,57 @@ impl Yumush {
1629 .into_any_element();1612 .into_any_element();
1630 }1613 }
1631 1614
1632- composer::format_actions(&self.chat.message_input, div().p(px(16.)))1615+ let has_text = self.chat.message_input.read(cx).text().len() > 0;
1616+
1617+ composer::format_actions(
1618+ &self.chat.message_input,
1619+ div()
1620+ .p(px(space::LG))
1621+ .border_t_1()
1622+ .border_color(palette.border),
1623+ )
1633 .children(pending)1624 .children(pending)
1634 .children(bar)1625 .children(bar)
1635 .children(self.chat.typing_label().map(|label| {1626 .children(self.chat.typing_label().map(|label| {
1636 div()1627 div()
1637- .pl(px(4.))1628+ .pl(px(space::XS))
1638- .pb(px(4.))1629+ .pb(px(space::XS))
1639- .text_size(text(12.))1630+ .text_size(text(text::CAPTION))
1640 .text_color(palette.muted)1631 .text_color(palette.muted)
1641 .child(label)1632 .child(label)
1642 }))1633 }))
1643 .child(1634 .child(
1644 div()1635 div()
1645- .min_h(px(40.))1636+ .min_h(px(size::ROW))
1646- .pl(px(4.))1637+ .pl(px(space::XS))
1647- .pr(px(4.))1638+ .pr(px(space::XS))
1648- .py(px(4.))1639+ .py(px(space::XS))
1649 .flex()1640 .flex()
1650 .items_center()1641 .items_center()
1651- .gap(px(8.))1642+ .gap(px(space::SM))
1652- .rounded(px(8.))
1653- .border_1()
1654- .border_color(palette.border)
1655- .bg(palette.field)
1656 .child(composer::plus_popover(&self.chat, &entity, palette))1643 .child(composer::plus_popover(&self.chat, &entity, palette))
1657 .child(composer::format_popover(palette))1644 .child(composer::format_popover(palette))
1658 .child(1645 .child(
1659 Textarea::new(&self.chat.message_input)1646 Textarea::new(&self.chat.message_input)
1660 .appearance(false)1647 .appearance(false)
1648+ .text_size(text(text::BODY))
1661 .text_color(palette.text)1649 .text_color(palette.text)
1662 .flex_1()1650 .flex_1()
1663 .min_w_0(),1651 .min_w_0(),
1664 )1652 )
1665 .child(voice_note::mic_button(&entity, palette))1653 .child(voice_note::mic_button(&entity, palette))
1666 .child(1654 .child(
1667- primary_button("send_button", palette, move |window, cx| {1655+ clickable("send_button", palette, move |window, cx| {
1668 entity1656 entity
1669 .update(cx, |yumush, cx| yumush.submit_composer(&input, window, cx))1657 .update(cx, |yumush, cx| yumush.submit_composer(&input, window, cx))
1670 })1658 })
1671 .tip("Send")1659 .tip("Send")
1672- .size(px(28.))1660+ .size(px(size::CONTROL_SM))
1673 .flex()1661 .flex()
1674 .items_center()1662 .items_center()
1675 .justify_center()1663 .justify_center()
1676- .rounded(px(6.))1664+ .text_color(if has_text { palette.text } else { palette.muted })
1677- .child(Icon::new(IconName::ArrowUp).w(px(14.)).h(px(14.))),1665+ .child(Icon::new(IconName::ArrowUp).size(px(size::ICON_SM))),
1678 ),1666 ),
1679 )1667 )
1680 .into_any_element()1668 .into_any_element()
@@ -2207,10 +2195,10 @@ impl Yumush {
2207 div()2195 div()
2208 .flex()2196 .flex()
2209 .flex_col()2197 .flex_col()
2210- .gap(px(14.))2198+ .gap(px(space::LG))
2211 .child(2199 .child(
2212 div()2200 div()
2213- .text_size(text(13.))2201+ .text_size(text(text::LABEL))
2214 .text_color(palette.muted)2202 .text_color(palette.muted)
2215 .child("Everyone in the call will hear you."),2203 .child("Everyone in the call will hear you."),
2216 )2204 )
@@ -2218,16 +2206,16 @@ impl Yumush {
2218 div()2206 div()
2219 .flex()2207 .flex()
2220 .justify_end()2208 .justify_end()
2221- .gap(px(8.))2209+ .gap(px(space::SM))
2222 .child(2210 .child(
2223 clickable("ghost_speak_cancel", palette, |window, cx| {2211 clickable("ghost_speak_cancel", palette, |window, cx| {
2224 window.close_dialog(cx)2212 window.close_dialog(cx)
2225 })2213 })
2226- .h(px(30.))2214+ .h(px(size::CONTROL))
2227- .px(px(14.))2215+ .px(px(space::LG))
2228 .flex()2216 .flex()
2229 .items_center()2217 .items_center()
2230- .rounded(px(8.))2218+ .rounded(px(radius::MD))
2231 .text_color(palette.muted)2219 .text_color(palette.muted)
2232 .child("Cancel"),2220 .child("Cancel"),
2233 )2221 )
@@ -2240,11 +2228,11 @@ impl Yumush {
2240 speak.update(cx, |yumush, cx| yumush.set_muted(false, cx));2228 speak.update(cx, |yumush, cx| yumush.set_muted(false, cx));
2241 },2229 },
2242 )2230 )
2243- .h(px(30.))2231+ .h(px(size::CONTROL))
2244- .px(px(14.))2232+ .px(px(space::LG))
2245 .flex()2233 .flex()
2246 .items_center()2234 .items_center()
2247- .rounded(px(8.))2235+ .rounded(px(radius::MD))
2248 .child("Speak"),2236 .child("Speak"),
2249 ),2237 ),
2250 ),2238 ),
@@ -2412,22 +2400,18 @@ impl Yumush {
2412 (false, true) => (IconName::Headphones, "Leave voice"),2400 (false, true) => (IconName::Headphones, "Leave voice"),
2413 };2401 };
2414 let id = format!("voice_button_{direct}_{in_voice}");2402 let id = format!("voice_button_{direct}_{in_voice}");
2415- let button = if in_voice {2403+ let color = if in_voice { palette.danger } else { palette.muted };
2416- primary_button(id.clone(), palette, on_click)
2417- .when(direct, |button| button.bg(palette.danger))
2418- } else {
2419- clickable(id, palette, on_click).text_color(palette.accent)
2420- };
2421 2404
2422 Some(2405 Some(
2423- button2406+ clickable(id, palette, on_click)
2407+ .text_color(color)
2424 .tip(tip)2408 .tip(tip)
2425- .size(px(28.))2409+ .size(px(size::CONTROL_SM))
2426 .flex()2410 .flex()
2427 .items_center()2411 .items_center()
2428 .justify_center()2412 .justify_center()
2429- .rounded(px(6.))2413+ .rounded_full()
2430- .child(Icon::new(icon).w(px(14.)).h(px(14.))),2414+ .child(Icon::new(icon).size(px(size::ICON_SM))),
2431 )2415 )
2432 }2416 }
2433 2417
@@ -2444,7 +2428,7 @@ impl Yumush {
2444 (direct && alone).then(|| {2428 (direct && alone).then(|| {
2445 div()2429 div()
2446 .text_color(palette.muted)2430 .text_color(palette.muted)
2447- .text_size(text(11.))2431+ .text_size(text(text::CAPTION))
2448 .child("Calling…")2432 .child("Calling…")
2449 })2433 })
2450 }2434 }
@@ -2459,25 +2443,26 @@ impl Yumush {
2459 div()2443 div()
2460 .flex()2444 .flex()
2461 .items_center()2445 .items_center()
2462- .gap(px(6.))2446+ .gap(px(space::SM))
2463- .child(Icon::new(IconName::PhoneIncoming).w(px(14.)).h(px(14.)))2447+ .child(Icon::new(IconName::PhoneIncoming).size(px(size::ICON_SM)))
2464 .child(format!("{} is calling", caller.username)),2448 .child(format!("{} is calling", caller.username)),
2465 )2449 )
2466 .child(2450 .child(
2467 div()2451 div()
2468 .flex()2452 .flex()
2469- .gap(px(6.))2453+ .gap(px(space::SM))
2470 .child(2454 .child(
2471- primary_button(2455+ clickable(
2472 "accept_call",2456 "accept_call",
2473 palette,2457 palette,
2474 entity_action(entity, move |yumush, window, cx| {2458 entity_action(entity, move |yumush, window, cx| {
2475 yumush.accept_call(accept_id, window, cx)2459 yumush.accept_call(accept_id, window, cx)
2476 }),2460 }),
2477 )2461 )
2478- .bg(palette.ok)2462+ .text_color(palette.ok)
2479- .px(px(8.))2463+ .font_weight(FontWeight::MEDIUM)
2480- .rounded(px(4.))2464+ .px(px(space::SM))
2465+ .rounded(px(radius::SM))
2481 .child("Accept"),2466 .child("Accept"),
2482 )2467 )
2483 .child(2468 .child(
@@ -2488,10 +2473,10 @@ impl Yumush {
2488 yumush.decline_call(community_id, window, cx)2473 yumush.decline_call(community_id, window, cx)
2489 }),2474 }),
2490 )2475 )
2491- .bg(palette.danger)2476+ .text_color(palette.danger)
2492- .text_color(palette.on_accent)2477+ .font_weight(FontWeight::MEDIUM)
2493- .px(px(8.))2478+ .px(px(space::SM))
2494- .rounded(px(4.))2479+ .rounded(px(radius::SM))
2495 .child("Decline"),2480 .child("Decline"),
2496 ),2481 ),
2497 ),2482 ),
@@ -2587,36 +2572,19 @@ impl Yumush {
2587 div()2572 div()
2588 .flex()2573 .flex()
2589 .items_center()2574 .items_center()
2590- .children(users.into_iter().take(3).enumerate().map(|(index, user)| {2575+ .gap(px(space::SM))
2591- let ring = if self.chat.waves.speaking.contains(&user.id) {2576+ .child(
2592- palette.ok2577+ div()
2593- } else {2578+ .text_size(text(text::LABEL))
2594- palette.panel2579+ .text_color(palette.muted)
2595- };2580+ .child(format!("{} in call", users.len())),
2596-2581+ )
2597- profile_popover(
2598- format!("voice_{}", user.id),
2599- Anchor::TopRight,
2600- user,
2601- entity,
2602- avatar(palette, user, px(20.), text(10.), &self.chat.avatars)
2603- .border_2()
2604- .border_color(ring)
2605- .cursor_pointer()
2606- .hover(move |style| style.border_color(palette.accent))
2607- .when(index > 0, |this| this.ml(px(-6.))),
2608- )
2609- }))
2610 .children(self.in_stage_chat().then(|| {2582 .children(self.in_stage_chat().then(|| {
2611 div()2583 div()
2612- .ml(px(8.))2584+ .ml(px(space::SM))
2613 .flex()2585 .flex()
2614 .items_center()2586 .items_center()
2615- .p(px(2.))2587+ .gap(px(space::XXS))
2616- .gap(px(2.))
2617- .rounded(px(6.))
2618- .border_1()
2619- .border_color(palette.border)
2620 .child(stage_button(2588 .child(stage_button(
2621 entity,2589 entity,
2622 palette,2590 palette,
@@ -2673,7 +2641,6 @@ fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -
2673 .trigger(MembersTrigger {2641 .trigger(MembersTrigger {
2674 palette,2642 palette,
2675 members: members.iter().map(|row| row.user.clone()).collect(),2643 members: members.iter().map(|row| row.user.clone()).collect(),
2676- avatars: avatars.clone(),
2677 })2644 })
2678 .content(move |_, _, _| {2645 .content(move |_, _, _| {
2679 let entity = entity.clone();2646 let entity = entity.clone();
@@ -2681,14 +2648,12 @@ fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -
2681 pop_in(2648 pop_in(
2682 "members_list",2649 "members_list",
2683 div()2650 div()
2684- .w(px(200.))2651+ .w(px(size::SIDEBAR))
2685- .p(px(4.))2652+ .p(px(space::XS))
2686 .flex()2653 .flex()
2687 .flex_col()2654 .flex_col()
2688- .rounded(px(8.))2655+ .rounded(px(radius::LG))
2689- .border_1()2656+ .bg(palette.field)
2690- .border_color(palette.border)
2691- .bg(palette.panel)
2692 .children(members.iter().map(2657 .children(members.iter().map(
2693 |MemberRow {2658 |MemberRow {
2694 user,2659 user,
@@ -2705,16 +2670,16 @@ fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -
2705 hoverable(2670 hoverable(
2706 format!("member_trigger_{}", user.id),2671 format!("member_trigger_{}", user.id),
2707 div()2672 div()
2708- .h(px(30.))2673+ .h(px(size::CONTROL))
2709- .px(px(8.))2674+ .px(px(space::SM))
2710 .flex()2675 .flex()
2711 .items_center()2676 .items_center()
2712- .gap(px(8.))2677+ .gap(px(space::SM))
2713- .rounded(px(6.))2678+ .rounded(px(radius::MD))
2714 .child(presence_avatar(2679 .child(presence_avatar(
2715- avatar(palette, user, px(18.), text(9.), &avatars),2680+ avatar(palette, user, px(size::ICON), text(text::CAPTION), &avatars),
2716 *presence,2681 *presence,
2717- px(18.),2682+ px(size::ICON),
2718 palette,2683 palette,
2719 ))2684 ))
2720 .child(2685 .child(
@@ -2727,25 +2692,23 @@ fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -
2727 div()2692 div()
2728 .flex()2693 .flex()
2729 .items_center()2694 .items_center()
2730- .gap(px(6.))2695+ .gap(px(space::SM))
2731 .child(user.username.clone())2696 .child(user.username.clone())
2732 .children(rank_tag(*rank, palette))2697 .children(rank_tag(*rank, palette))
2733 .children(in_voice.then(|| {2698 .children(in_voice.then(|| {
2734 Icon::new(IconName::Headphones)2699 Icon::new(IconName::Headphones)
2735- .w(px(12.))2700+ .size(px(size::ICON_SM))
2736- .h(px(12.))
2737 .text_color(palette.muted)2701 .text_color(palette.muted)
2738 }))2702 }))
2739 .children(muted.then(|| {2703 .children(muted.then(|| {
2740 Icon::new(IconName::MicOff)2704 Icon::new(IconName::MicOff)
2741- .w(px(12.))2705+ .size(px(size::ICON_SM))
2742- .h(px(12.))
2743 .text_color(palette.danger)2706 .text_color(palette.danger)
2744 })),2707 })),
2745 )2708 )
2746 .children((!user.status.is_empty()).then(|| {2709 .children((!user.status.is_empty()).then(|| {
2747 div()2710 div()
2748- .text_size(text(11.))2711+ .text_size(text(text::CAPTION))
2749 .text_color(palette.muted)2712 .text_color(palette.muted)
2750 .truncate()2713 .truncate()
2751 .child(user.status.clone())2714 .child(user.status.clone())
@@ -2766,23 +2729,41 @@ fn accent_bar(palette: Palette) -> Div {
2766 .flex()2729 .flex()
2767 .items_center()2730 .items_center()
2768 .justify_between()2731 .justify_between()
2769- .gap(px(8.))2732+ .gap(px(space::SM))
2770- .px(px(12.))2733+ .px(px(space::MD))
2771- .py(px(6.))2734+ .py(px(space::XS))
2772- .bg(palette.accent)2735+ .text_size(text(text::LABEL))
2773- .text_color(palette.on_accent)2736+ .text_color(palette.text)
2737+ .border_b_1()
2738+ .border_color(palette.border)
2739+}
2740+
2741+fn thread_dot(mine: bool, palette: Palette) -> Div {
2742+ let dot = div()
2743+ .absolute()
2744+ .left(px(-(space::LG + space::XS)))
2745+ .top(px(space::SM))
2746+ .size(px(space::SM))
2747+ .rounded_full();
2748+ if mine {
2749+ dot.bg(palette.text)
2750+ } else {
2751+ dot.border_1()
2752+ .border_color(palette.tokens.faint())
2753+ .bg(palette.window)
2754+ }
2774 }2755 }
2775 2756
2776 fn new_divider(palette: Palette) -> impl IntoElement {2757 fn new_divider(palette: Palette) -> impl IntoElement {
2777 div()2758 div()
2778 .flex()2759 .flex()
2779 .items_center()2760 .items_center()
2780- .gap(px(8.))2761+ .gap(px(space::SM))
2781- .my(px(6.))2762+ .my(px(space::SM))
2782- .child(div().flex_1().h(px(1.)).bg(palette.accent))2763+ .child(div().flex_1().h(px(stroke::LINE)).bg(palette.accent))
2783 .child(2764 .child(
2784 div()2765 div()
2785- .text_size(text(10.))2766+ .text_size(text(text::CAPTION))
2786 .text_color(palette.accent)2767 .text_color(palette.accent)
2787 .child("New"),2768 .child("New"),
2788 )2769 )
@@ -2795,11 +2776,11 @@ fn older_button(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement {
2795 entity.update(cx, |yumush, cx| yumush.load_older_messages(window, cx));2776 entity.update(cx, |yumush, cx| yumush.load_older_messages(window, cx));
2796 })2777 })
2797 .self_center()2778 .self_center()
2798- .h(px(24.))2779+ .h(px(size::CONTROL_SM))
2799- .px(px(8.))2780+ .px(px(space::SM))
2800 .flex()2781 .flex()
2801 .items_center()2782 .items_center()
2802- .rounded(px(6.))2783+ .rounded(px(radius::MD))
2803 .text_color(palette.muted)2784 .text_color(palette.muted)
2804 .child("↑")2785 .child("↑")
2805 }2786 }
@@ -2844,11 +2825,10 @@ fn render_call(
2844 .id(format!("message_row_{}", message.id))2825 .id(format!("message_row_{}", message.id))
2845 .flex()2826 .flex()
2846 .items_center()2827 .items_center()
2847- .gap(px(6.))2828+ .gap(px(space::SM))
2848- .pl(px(28.))2829+ .text_size(text(text::CAPTION))
2849- .text_size(text(12.))
2850 .text_color(palette.muted)2830 .text_color(palette.muted)
2851- .child(Icon::new(icon).w(px(14.)).h(px(14.)).text_color(color))2831+ .child(Icon::new(icon).size(px(size::ICON_SM)).text_color(color))
2852 .child(label)2832 .child(label)
2853 .into_any_element()2833 .into_any_element()
2854 }2834 }
@@ -2870,22 +2850,19 @@ fn render_message(
2870 let name = div()2850 let name = div()
2871 .flex()2851 .flex()
2872 .items_center()2852 .items_center()
2873- .gap(px(8.))2853+ .gap(px(space::SM))
2874- .child(match author {
2875- Some(user) => avatar(palette, user, px(20.), text(10.), &chat.avatars),
2876- None => badge(palette, message.user_id, username, px(20.), text(10.)).rounded_full(),
2877- })
2878 .child(2854 .child(
2879 div()2855 div()
2880 .id(format!("author_name_{}", message.id))2856 .id(format!("author_name_{}", message.id))
2881 .font_weight(FontWeight::SEMIBOLD)2857 .font_weight(FontWeight::SEMIBOLD)
2882- .text_color(palette.tinted(message.user_id))2858+ .text_color(palette.text)
2883 .when(author.is_some(), |this| {2859 .when(author.is_some(), |this| {
2884 this.hover(|style| style.underline())2860 this.hover(|style| style.underline())
2885 })2861 })
2886 .child(username.to_string()),2862 .child(username.to_string()),
2887 );2863 );
2888 let mentioned = me.is_some_and(|me| mentions(&message.body, &me.username));2864 let mentioned = me.is_some_and(|me| mentions(&message.body, &me.username));
2865+ let mine = me.is_some_and(|me| me.id == message.user_id);
2889 let group = format!("message_{}", message.id);2866 let group = format!("message_{}", message.id);
2890 let selecting = matches!(chat.composer, Composer::Select { .. });2867 let selecting = matches!(chat.composer, Composer::Select { .. });
2891 let selected = matches!(&chat.composer, Composer::Select { ids } if ids.contains(&message.id));2868 let selected = matches!(&chat.composer, Composer::Select { ids } if ids.contains(&message.id));
@@ -2897,14 +2874,15 @@ fn render_message(
2897 let row = div()2874 let row = div()
2898 .id(format!("message_row_{}", message.id))2875 .id(format!("message_row_{}", message.id))
2899 .group(group.clone())2876 .group(group.clone())
2877+ .relative()
2900 .flex()2878 .flex()
2901 .flex_col()2879 .flex_col()
2902 .min_w_0()2880 .min_w_0()
2903- .when(first && spaced && !selecting, |this| this.mt(px(14.)))2881+ .hover(|style| style.bg(palette.hover))
2904- .when(highlighted, |this| this.bg(palette.accent.opacity(0.2)))2882+ .when(first && spaced && !selecting, |this| this.mt(px(space::LG)))
2883+ .when(highlighted, |this| this.bg(palette.tokens.press()))
2905 .when(mentioned, |this| {2884 .when(mentioned, |this| {
2906- this.bg(palette.accent.opacity(0.08))2885+ this.border_l_2()
2907- .border_l_2()
2908 .border_color(palette.accent)2886 .border_color(palette.accent)
2909 })2887 })
2910 .when(first, |this| {2888 .when(first, |this| {
@@ -2922,14 +2900,16 @@ fn render_message(
2922 2900
2923 this.child(2901 this.child(
2924 div()2902 div()
2903+ .relative()
2925 .flex()2904 .flex()
2926 .items_center()2905 .items_center()
2927- .gap(px(8.))2906+ .gap(px(space::SM))
2928- .mb(px(2.))2907+ .mb(px(space::XXS))
2908+ .child(thread_dot(mine, palette))
2929 .child(author)2909 .child(author)
2930 .child(2910 .child(
2931 div()2911 div()
2932- .text_size(text(12.))2912+ .text_size(text(text::CAPTION))
2933 .text_color(palette.muted)2913 .text_color(palette.muted)
2934 .child(millis_time(message.created_at, CLOCK)),2914 .child(millis_time(message.created_at, CLOCK)),
2935 ),2915 ),
@@ -2938,19 +2918,18 @@ fn render_message(
2938 .child(2918 .child(
2939 div()2919 div()
2940 .relative()2920 .relative()
2941- .pl(px(28.))
2942 .min_w_0()2921 .min_w_0()
2943 .flex()2922 .flex()
2944 .items_center()2923 .items_center()
2945- .gap(px(8.))2924+ .gap(px(space::SM))
2946 .child(2925 .child(
2947 div()2926 div()
2948 .min_w_0()2927 .min_w_0()
2949- .max_w(px(720.))2928+ .max_w(px(size::PAGE))
2950 .when(message.body.contains("```"), |this| this.w_full())2929 .when(message.body.contains("```"), |this| this.w_full())
2951 .flex()2930 .flex()
2952 .flex_col()2931 .flex_col()
2953- .gap(px(6.))2932+ .gap(px(space::SM))
2954 .children(message_actions::quote_line(message, chat, palette))2933 .children(message_actions::quote_line(message, chat, palette))
2955 .when(!message.body.is_empty(), |this| {2934 .when(!message.body.is_empty(), |this| {
2956 this.child(2935 this.child(
@@ -2960,7 +2939,8 @@ fn render_message(
2960 .flex()2939 .flex()
2961 .flex_wrap()2940 .flex_wrap()
2962 .items_baseline()2941 .items_baseline()
2963- .gap(px(4.))2942+ .gap(px(space::XS))
2943+ .text_size(text(text::BODY))
2964 .line_height(relative(1.55))2944 .line_height(relative(1.55))
2965 .text_color(palette.body)2945 .text_color(palette.body)
2966 .child(2946 .child(
@@ -2980,7 +2960,7 @@ fn render_message(
2980 .when(message.edited, |this| {2960 .when(message.edited, |this| {
2981 this.child(2961 this.child(
2982 div()2962 div()
2983- .text_size(text(11.))2963+ .text_size(text(text::CAPTION))
2984 .text_color(palette.muted)2964 .text_color(palette.muted)
2985 .child("(edited)"),2965 .child("(edited)"),
2986 )2966 )
@@ -3015,7 +2995,7 @@ fn render_message(
3015 div()2995 div()
3016 .absolute()2996 .absolute()
3017 .right_0()2997 .right_0()
3018- .top(px(-18.))2998+ .top(px(-space::LG))
3019 .child(message_actions::actions(2999 .child(message_actions::actions(
3020 message, chat, me, entity, palette, group,3000 message, chat, me, entity, palette, group,
3021 ))3001 ))
@@ -3033,22 +3013,22 @@ fn render_message(
3033 let message_id = message.id;3013 let message_id = message.id;
3034 let select_entity = entity.clone();3014 let select_entity = entity.clone();
3035 let mark_line = if first {3015 let mark_line = if first {
3036- div().h(px(20.))3016+ div().h(px(size::CHIP))
3037 } else {3017 } else {
3038 div().line_height(relative(1.55)).child("\u{200b}")3018 div().line_height(relative(1.55)).child("\u{200b}")
3039 };3019 };
3040 3020
3041 div()3021 div()
3042 .id(format!("select_row_{}", message.id))3022 .id(format!("select_row_{}", message.id))
3043- .when(first && spaced, |this| this.mt(px(14.)))3023+ .when(first && spaced, |this| this.mt(px(space::LG)))
3044 .flex()3024 .flex()
3045 .items_start()3025 .items_start()
3046- .gap(px(8.))3026+ .gap(px(space::SM))
3047- .px(px(6.))3027+ .px(px(space::SM))
3048- .rounded(px(6.))3028+ .rounded(px(radius::MD))
3049 .cursor_pointer()3029 .cursor_pointer()
3050- .hover(|style| style.bg(palette.hover.opacity(0.5)))3030+ .hover(|style| style.bg(palette.hover))
3051- .when(selected, |this| this.bg(palette.hover))3031+ .when(selected, |this| this.bg(palette.tokens.press()))
3052 .on_click(move |_, _, cx| {3032 .on_click(move |_, _, cx| {
3053 select_entity.update(cx, |yumush, cx| yumush.toggle_select(message_id, cx));3033 select_entity.update(cx, |yumush, cx| yumush.toggle_select(message_id, cx));
3054 })3034 })
@@ -3116,14 +3096,14 @@ fn stats_button(entity: &Entity<Yumush>, palette: Palette, open: bool) -> impl I
3116 } else {3096 } else {
3117 "Connection stats"3097 "Connection stats"
3118 })3098 })
3119- .size(px(26.))3099+ .size(px(size::CONTROL_SM))
3120 .flex()3100 .flex()
3121 .items_center()3101 .items_center()
3122 .justify_center()3102 .justify_center()
3123- .rounded(px(6.))3103+ .rounded(px(radius::MD))
3124- .when(open, |this| this.bg(palette.ok.opacity(0.13)))3104+ .when(open, |this| this.bg(palette.tokens.press()))
3125 .text_color(if open { palette.ok } else { palette.muted })3105 .text_color(if open { palette.ok } else { palette.muted })
3126- .child(Icon::new(IconName::Activity).w(px(14.)).h(px(14.)))3106+ .child(Icon::new(IconName::Activity).size(px(size::ICON_SM)))
3127 }3107 }
3128 3108
3129 fn stage_button(3109 fn stage_button(
@@ -3143,16 +3123,16 @@ fn stage_button(
3143 }),3123 }),
3144 )3124 )
3145 .tip(if active { "Hide" } else { name })3125 .tip(if active { "Hide" } else { name })
3146- .size(px(26.))3126+ .size(px(size::CONTROL_SM))
3147 .flex()3127 .flex()
3148 .items_center()3128 .items_center()
3149 .justify_center()3129 .justify_center()
3150- .rounded(px(6.))3130+ .rounded(px(radius::MD))
3151- .when(active, |this| this.bg(palette.accent.opacity(0.13)))3131+ .when(active, |this| this.bg(palette.tokens.press()))
3152 .text_color(if active {3132 .text_color(if active {
3153 palette.accent3133 palette.accent
3154 } else {3134 } else {
3155 palette.muted3135 palette.muted
3156 })3136 })
3157- .child(Icon::new(icon).w(px(14.)).h(px(14.)))3137+ .child(Icon::new(icon).size(px(size::ICON_SM)))
3158 }3138 }
crates/client/src/gui/community_settings.rsmodified+29 -28
@@ -32,6 +32,7 @@ use super::{
32 Editable, Picture, danger_section, delete_control, page, picked_avatar, picture_card, row,32 Editable, Picture, danger_section, delete_control, page, picked_avatar, picture_card, row,
33 section, small_button, text_row,33 section, small_button, text_row,
34 },34 },
35+ style::{radius, size, space, text as text_token},
35 text,36 text,
36 widget::search_text,37 widget::search_text,
37 };38 };
@@ -97,8 +98,8 @@ impl Yumush {
97 image: community_icon(98 image: community_icon(
98 palette,99 palette,
99 community,100 community,
100- px(64.),101+ px(size::AVATAR_LG),
101- text(24.),102+ text(text_token::TITLE),
102 &self.chat.avatars,103 &self.chat.avatars,
103 ),104 ),
104 title: community.name.clone(),105 title: community.name.clone(),
@@ -154,10 +155,10 @@ impl Yumush {
154 div()155 div()
155 .flex()156 .flex()
156 .items_center()157 .items_center()
157- .gap(px(8.))158+ .gap(px(space::SM))
158 .child(159 .child(
159 div()160 div()
160- .text_size(text(12.))161+ .text_size(text(text_token::CAPTION))
161 .text_color(palette.muted)162 .text_color(palette.muted)
162 .child(bans_count.to_string()),163 .child(bans_count.to_string()),
163 )164 )
@@ -500,11 +501,11 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(
500 select: fn(&mut Yumush, T, &mut Window, &mut Context<Yumush>),501 select: fn(&mut Yumush, T, &mut Window, &mut Context<Yumush>),
501 ) -> impl IntoElement {502 ) -> impl IntoElement {
502 div()503 div()
503- .h(px(24.))504+ .h(px(size::CONTROL_SM))
504- .p(px(2.))505+ .p(px(space::XXS))
505 .flex()506 .flex()
506- .gap(px(2.))507+ .gap(px(space::XXS))
507- .rounded(px(6.))508+ .rounded(px(radius::MD))
508 .border_1()509 .border_1()
509 .border_color(palette.border)510 .border_color(palette.border)
510 .bg(palette.field)511 .bg(palette.field)
@@ -518,11 +519,11 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(
518 select(yumush, choice, window, cx)519 select(yumush, choice, window, cx)
519 }),520 }),
520 )521 )
521- .px(px(8.))522+ .px(px(space::SM))
522 .flex()523 .flex()
523 .items_center()524 .items_center()
524- .rounded(px(4.))525+ .rounded(px(radius::SM))
525- .text_size(text(12.))526+ .text_size(text(text_token::CAPTION))
526 .text_color(if active { palette.text } else { palette.muted })527 .text_color(if active { palette.text } else { palette.muted })
527 .when(active, |this| this.bg(palette.hover))528 .when(active, |this| this.bg(palette.hover))
528 .child(label)529 .child(label)
@@ -539,7 +540,7 @@ fn moderation_body(
539 ) -> impl IntoElement {540 ) -> impl IntoElement {
540 let list = if rows.is_empty() {541 let list = if rows.is_empty() {
541 div()542 div()
542- .text_size(text(13.))543+ .text_size(text(text_token::LABEL))
543 .text_color(palette.muted)544 .text_color(palette.muted)
544 .child(empty)545 .child(empty)
545 .into_any_element()546 .into_any_element()
@@ -550,10 +551,10 @@ fn moderation_body(
550 div()551 div()
551 .flex()552 .flex()
552 .flex_col()553 .flex_col()
553- .gap(px(12.))554+ .gap(px(space::MD))
554 .child(Input::new(search))555 .child(Input::new(search))
555 .child(sort)556 .child(sort)
556- .child(div().id(id).max_h(px(360.)).overflow_y_scroll().child(list))557+ .child(div().id(id).max_h(px(size::SHEET)).overflow_y_scroll().child(list))
557 }558 }
558 559
559 fn ban_list<'a>(bans: &'a [Ban], query: &str, sort: BanSort) -> Vec<&'a Ban> {560 fn ban_list<'a>(bans: &'a [Ban], query: &str, sort: BanSort) -> Vec<&'a Ban> {
@@ -617,22 +618,22 @@ fn log_text(entry: &LogEntry) -> String {
617 618
618 fn log_row(entry: &LogEntry, palette: Palette, avatars: &HashMap<Id, Arc<Image>>) -> Div {619 fn log_row(entry: &LogEntry, palette: Palette, avatars: &HashMap<Id, Arc<Image>>) -> Div {
619 div()620 div()
620- .min_h(px(40.))621+ .min_h(px(size::ROW))
621- .px(px(12.))622+ .px(px(space::MD))
622 .flex()623 .flex()
623 .items_center()624 .items_center()
624- .gap(px(8.))625+ .gap(px(space::SM))
625 .children(626 .children(
626 entry627 entry
627 .actor628 .actor
628 .as_ref()629 .as_ref()
629- .map(|actor| avatar(palette, actor, px(20.), text(10.), avatars)),630+ .map(|actor| avatar(palette, actor, px(size::AVATAR), text(text_token::CAPTION), avatars)),
630 )631 )
631 .child(div().flex_1().min_w_0().truncate().child(log_text(entry)))632 .child(div().flex_1().min_w_0().truncate().child(log_text(entry)))
632 .child(633 .child(
633 div()634 div()
634 .flex_shrink_0()635 .flex_shrink_0()
635- .text_size(text(11.))636+ .text_size(text(text_token::CAPTION))
636 .text_color(palette.muted)637 .text_color(palette.muted)
637 .child(millis_time(entry.created_at, STAMP)),638 .child(millis_time(entry.created_at, STAMP)),
638 )639 )
@@ -652,7 +653,7 @@ fn leave_control(entity: &Entity<Yumush>, community_id: Id, palette: Palette) ->
652 },653 },
653 )654 )
654 .border_1()655 .border_1()
655- .border_color(palette.danger.opacity(0.5))656+ .border_color(palette.border)
656 .child("Leave")657 .child("Leave")
657 }658 }
658 659
@@ -667,16 +668,16 @@ fn ban_row(
667 let user_id = user.id;668 let user_id = user.id;
668 669
669 div()670 div()
670- .h(px(48.))671+ .h(px(size::ROW))
671- .px(px(12.))672+ .px(px(space::MD))
672 .flex()673 .flex()
673 .items_center()674 .items_center()
674- .gap(px(8.))675+ .gap(px(space::SM))
675 .child(user_link(676 .child(user_link(
676 format!("ban_avatar_{user_id}"),677 format!("ban_avatar_{user_id}"),
677 Some(user),678 Some(user),
678 &entity,679 &entity,
679- avatar(palette, user, px(20.), text(10.), avatars),680+ avatar(palette, user, px(size::AVATAR), text(text_token::CAPTION), avatars),
680 ))681 ))
681 .child(682 .child(
682 div()683 div()
@@ -692,7 +693,7 @@ fn ban_row(
692 ))693 ))
693 .children(ban.reason.clone().map(|reason| {694 .children(ban.reason.clone().map(|reason| {
694 div()695 div()
695- .text_size(text(11.))696+ .text_size(text(text_token::CAPTION))
696 .text_color(palette.muted)697 .text_color(palette.muted)
697 .truncate()698 .truncate()
698 .child(reason)699 .child(reason)
@@ -702,11 +703,11 @@ fn ban_row(
702 clickable(format!("unban_{}", user.id), palette, move |window, cx| {703 clickable(format!("unban_{}", user.id), palette, move |window, cx| {
703 entity.update(cx, |yumush, cx| yumush.unban(user_id, window, cx));704 entity.update(cx, |yumush, cx| yumush.unban(user_id, window, cx));
704 })705 })
705- .h(px(28.))706+ .h(px(size::CONTROL_SM))
706- .px(px(8.))707+ .px(px(space::SM))
707 .flex()708 .flex()
708 .items_center()709 .items_center()
709- .rounded(px(6.))710+ .rounded(px(radius::MD))
710 .text_color(palette.danger)711 .text_color(palette.danger)
711 .child("Unban"),712 .child("Unban"),
712 )713 )
crates/client/src/gui/composer.rsmodified+61 -53
@@ -1,3 +1,4 @@
1+use super::style::{radius, size, space, stroke, text};
1 use super::text;2 use super::text;
2 use super::widget::{compact_field, icon_button, panel, spawn_done};3 use super::widget::{compact_field, icon_button, panel, spawn_done};
3 use common::model::Id;4 use common::model::Id;
@@ -24,7 +25,9 @@ use gpui_kit::{
24 popover::Popover,25 popover::Popover,
25 text::TextView,26 text::TextView,
26 },27 },
27- div, px,28+ div,
29+ prelude::FluentBuilder as _,
30+ px,
28 };31 };
29 32
30 use super::{33 use super::{
@@ -89,13 +92,13 @@ pub fn selection_bar(ids: &[Id], entity: &Entity<Yumush>, palette: Palette) -> i
89 let forward_entity = entity.clone();92 let forward_entity = entity.clone();
90 93
91 div()94 div()
92- .h(px(40.))95+ .h(px(size::ROW))
93- .pl(px(14.))96+ .pl(px(space::LG))
94- .pr(px(6.))97+ .pr(px(space::XS))
95 .flex()98 .flex()
96 .items_center()99 .items_center()
97- .gap(px(8.))100+ .gap(px(space::SM))
98- .rounded(px(8.))101+ .rounded(px(radius::MD))
99 .border_1()102 .border_1()
100 .border_color(palette.border)103 .border_color(palette.border)
101 .bg(palette.field)104 .bg(palette.field)
@@ -105,12 +108,12 @@ pub fn selection_bar(ids: &[Id], entity: &Entity<Yumush>, palette: Palette) -> i
105 let selected = selected.clone();108 let selected = selected.clone();
106 forward_entity.update(cx, |yumush, cx| yumush.open_forward(selected, window, cx));109 forward_entity.update(cx, |yumush, cx| yumush.open_forward(selected, window, cx));
107 })110 })
108- .h(px(28.))111+ .h(px(size::CONTROL_SM))
109- .px(px(10.))112+ .px(px(space::MD))
110 .flex()113 .flex()
111 .items_center()114 .items_center()
112- .rounded(px(6.))115+ .rounded(px(radius::MD))
113- .text_size(text(12.))116+ .text_size(text(text::CAPTION))
114 .child("Forward"),117 .child("Forward"),
115 )118 )
116 .child(cancel_button(entity, palette))119 .child(cancel_button(entity, palette))
@@ -118,15 +121,15 @@ pub fn selection_bar(ids: &[Id], entity: &Entity<Yumush>, palette: Palette) -> i
118 121
119 fn bar(palette: Palette) -> Div {122 fn bar(palette: Palette) -> Div {
120 div()123 div()
121- .h(px(28.))124+ .h(px(size::CONTROL_SM))
122- .mb(px(8.))125+ .mb(px(space::SM))
123- .px(px(8.))126+ .pl(px(space::SM))
124 .flex()127 .flex()
125 .items_center()128 .items_center()
126- .gap(px(6.))129+ .gap(px(space::SM))
127- .rounded(px(6.))130+ .border_l(px(stroke::LINE))
128- .bg(palette.hover)131+ .border_color(palette.border)
129- .text_size(text(12.))132+ .text_size(text(text::CAPTION))
130 .text_color(palette.muted)133 .text_color(palette.muted)
131 }134 }
132 135
@@ -163,13 +166,13 @@ fn reply_bar(
163 fn slow_bar(seconds: u64, palette: Palette) -> impl IntoElement {166 fn slow_bar(seconds: u64, palette: Palette) -> impl IntoElement {
164 bar(palette)167 bar(palette)
165 .text_color(palette.danger)168 .text_color(palette.danger)
166- .child(Icon::new(IconName::Hourglass).w(px(12.)).h(px(12.)))169+ .child(Icon::new(IconName::Hourglass).size(px(size::ICON_SM)))
167 .child(format!("Slow down, you can send again in {seconds}s"))170 .child(format!("Slow down, you can send again in {seconds}s"))
168 }171 }
169 172
170 fn edit_bar(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement {173 fn edit_bar(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement {
171 bar(palette)174 bar(palette)
172- .child(Icon::new(IconName::Pencil).w(px(12.)).h(px(12.)))175+ .child(Icon::new(IconName::Pencil).size(px(size::ICON_SM)))
173 .child("Editing")176 .child("Editing")
174 .child(div().flex_1())177 .child(div().flex_1())
175 .child(cancel_button(entity, palette))178 .child(cancel_button(entity, palette))
@@ -529,9 +532,9 @@ pub(super) fn trigger_icon(
529 .flex()532 .flex()
530 .items_center()533 .items_center()
531 .justify_center()534 .justify_center()
532- .rounded(px(6.))535+ .rounded(px(radius::MD))
533 .text_color(palette.muted)536 .text_color(palette.muted)
534- .child(Icon::new(icon).w(px(14.)).h(px(14.))),537+ .child(Icon::new(icon).size(px(size::ICON_SM))),
535 palette,538 palette,
536 ))539 ))
537 }540 }
@@ -540,23 +543,28 @@ pub fn format_popover(palette: Palette) -> impl IntoElement {
540 Popover::new("format_popover")543 Popover::new("format_popover")
541 .anchor(Anchor::BottomLeft)544 .anchor(Anchor::BottomLeft)
542 .appearance(false)545 .appearance(false)
543- .trigger(trigger_icon("format_trigger", IconName::Type, 28., palette))546+ .trigger(trigger_icon(
547+ "format_trigger",
548+ IconName::Type,
549+ size::CONTROL_SM,
550+ palette,
551+ ))
544 .content(move |_, _, _| {552 .content(move |_, _, _| {
545 pop_in(553 pop_in(
546 "format_list",554 "format_list",
547 panel(palette)555 panel(palette)
548- .w(px(340.))556+ .w(px(size::SHEET))
549- .p(px(8.))557+ .p(px(space::SM))
550 .flex()558 .flex()
551 .flex_col()559 .flex_col()
552- .gap(px(6.))560+ .gap(px(space::SM))
553- .text_size(text(12.))561+ .text_size(text(text::CAPTION))
554 .children(FORMAT_ROWS.map(|(syntax, shortcut)| {562 .children(FORMAT_ROWS.map(|(syntax, shortcut)| {
555 div()563 div()
556 .flex()564 .flex()
557 .items_center()565 .items_center()
558- .gap(px(12.))566+ .gap(px(space::MD))
559- .child(div().w(px(100.)).text_color(palette.muted).child(syntax))567+ .child(div().w(px(size::THUMB)).text_color(palette.muted).child(syntax))
560 .child(div().flex_1().child(TextView::markdown(syntax, syntax)))568 .child(div().flex_1().child(TextView::markdown(syntax, syntax)))
561 .child(569 .child(
562 div()570 div()
@@ -584,16 +592,16 @@ fn plus_row(
584 on_click: impl Fn(&mut Window, &mut App) + 'static,592 on_click: impl Fn(&mut Window, &mut App) + 'static,
585 ) -> impl IntoElement {593 ) -> impl IntoElement {
586 clickable(id, palette, on_click)594 clickable(id, palette, on_click)
587- .h(px(32.))595+ .h(px(size::CONTROL))
588- .px(px(8.))596+ .px(px(space::SM))
589- .gap(px(8.))597+ .gap(px(space::SM))
590- .rounded(px(6.))598+ .rounded(px(radius::MD))
591 .flex()599 .flex()
592 .items_center()600 .items_center()
593 .child(601 .child(
594 div()602 div()
595 .text_color(palette.muted)603 .text_color(palette.muted)
596- .child(Icon::new(icon).w(px(14.)).h(px(14.))),604+ .child(Icon::new(icon).size(px(size::ICON_SM))),
597 )605 )
598 .child(label)606 .child(label)
599 }607 }
@@ -614,13 +622,13 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
614 hoverable(622 hoverable(
615 "plus_trigger",623 "plus_trigger",
616 div()624 div()
617- .size(px(28.))625+ .size(px(size::CONTROL_SM))
618 .flex()626 .flex()
619 .items_center()627 .items_center()
620 .justify_center()628 .justify_center()
621- .rounded(px(6.))629+ .rounded(px(radius::MD))
622 .text_color(palette.muted)630 .text_color(palette.muted)
623- .child(Icon::new(IconName::Plus).w(px(16.)).h(px(16.))),631+ .child(Icon::new(IconName::Plus).size(px(size::ICON_SM))),
624 palette,632 palette,
625 )633 )
626 .on_mouse_down(MouseButton::Left, move |_, _, cx| {634 .on_mouse_down(MouseButton::Left, move |_, _, cx| {
@@ -635,11 +643,11 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
635 return pop_in(643 return pop_in(
636 "plus_menu",644 "plus_menu",
637 panel(palette)645 panel(palette)
638- .w(px(180.))646+ .w(px(size::SIDEBAR))
639- .p(px(4.))647+ .p(px(space::XS))
640 .flex()648 .flex()
641 .flex_col()649 .flex_col()
642- .gap(px(4.))650+ .gap(px(space::XS))
643 .child(plus_row(651 .child(plus_row(
644 "plus_file",652 "plus_file",
645 IconName::File,653 IconName::File,
@@ -673,12 +681,12 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
673 pop_in(681 pop_in(
674 "poll_form",682 "poll_form",
675 panel(palette)683 panel(palette)
676- .w(px(300.))684+ .w(px(size::POPOVER))
677- .p(px(8.))685+ .p(px(space::SM))
678 .flex()686 .flex()
679 .flex_col()687 .flex_col()
680- .gap(px(6.))688+ .gap(px(space::SM))
681- .text_size(text(12.))689+ .text_size(text(text::CAPTION))
682 .child(compact_field(palette, &question))690 .child(compact_field(palette, &question))
683 .children(options.iter().enumerate().map(|(index, option)| {691 .children(options.iter().enumerate().map(|(index, option)| {
684 let remove = entity.clone();692 let remove = entity.clone();
@@ -687,7 +695,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
687 div()695 div()
688 .flex()696 .flex()
689 .items_center()697 .items_center()
690- .gap(px(6.))698+ .gap(px(space::SM))
691 .child(699 .child(
692 div()700 div()
693 .flex_1()701 .flex_1()
@@ -716,9 +724,9 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
716 div()724 div()
717 .flex()725 .flex()
718 .items_center()726 .items_center()
719- .gap(px(4.))727+ .gap(px(space::XS))
720 .text_color(palette.muted)728 .text_color(palette.muted)
721- .child(Icon::new(IconName::Timer).w(px(14.)).h(px(14.)))729+ .child(Icon::new(IconName::Timer).size(px(size::ICON_SM)))
722 .children(POLL_DURATIONS.map(|(label, seconds)| {730 .children(POLL_DURATIONS.map(|(label, seconds)| {
723 let set = duration_entity.clone();731 let set = duration_entity.clone();
724 let active = duration == seconds;732 let active = duration == seconds;
@@ -728,15 +736,15 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
728 cx.notify();736 cx.notify();
729 })737 })
730 })738 })
731- .px(px(6.))739+ .px(px(space::SM))
732- .py(px(2.))740+ .py(px(space::XXS))
733- .rounded(px(4.))741+ .rounded(px(radius::SM))
734 .text_color(if active {742 .text_color(if active {
735 palette.accent743 palette.accent
736 } else {744 } else {
737 palette.muted745 palette.muted
738 })746 })
739- .bg(palette.accent.opacity(if active { 0.15 } else { 0. }))747+ .when(active, |this| this.bg(palette.tokens.press()))
740 .child(label)748 .child(label)
741 })),749 })),
742 )750 )
@@ -745,7 +753,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
745 div()753 div()
746 .flex()754 .flex()
747 .items_center()755 .items_center()
748- .gap(px(12.))756+ .gap(px(space::MD))
749 .child(757 .child(
750 Checkbox::new("poll_multiple")758 Checkbox::new("poll_multiple")
751 .label("Multiple answers")759 .label("Multiple answers")
@@ -776,11 +784,11 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
776 popover.update(cx, |state, cx| state.dismiss(window, cx));784 popover.update(cx, |state, cx| state.dismiss(window, cx));
777 }785 }
778 })786 })
779- .h(px(28.))787+ .h(px(size::CONTROL_SM))
780 .flex()788 .flex()
781 .items_center()789 .items_center()
782 .justify_center()790 .justify_center()
783- .rounded(px(6.))791+ .rounded(px(radius::MD))
784 .child("Create"),792 .child("Create"),
785 ),793 ),
786 Anchor::BottomLeft,794 Anchor::BottomLeft,
crates/client/src/gui/forward.rsmodified+10 -10
@@ -1,4 +1,4 @@
1-use super::text;1+use super::style::{radius, size, space, text};
2 use common::call::ForwardMessages;2 use common::call::ForwardMessages;
3 use common::model::Id;3 use common::model::Id;
4 use gpui_kit::{4 use gpui_kit::{
@@ -80,13 +80,13 @@ impl Render for Forward {
80 yumush.forward_to(selected, community_id, keep_authors, window, cx)80 yumush.forward_to(selected, community_id, keep_authors, window, cx)
81 });81 });
82 })82 })
83- .h(px(28.))83+ .h(px(size::CONTROL_SM))
84- .px(px(8.))84+ .px(px(space::SM))
85 .flex()85 .flex()
86 .items_center()86 .items_center()
87- .gap(px(8.))87+ .gap(px(space::SM))
88- .rounded(px(6.))88+ .rounded(px(radius::MD))
89- .child(yumush.community_badge(community, px(16.), text(9.), palette))89+ .child(yumush.community_badge(community, px(size::ICON), super::text(text::CAPTION), palette))
90 .child(90 .child(
91 div()91 div()
92 .flex_1()92 .flex_1()
@@ -101,7 +101,7 @@ impl Render for Forward {
101 div()101 div()
102 .flex()102 .flex()
103 .flex_col()103 .flex_col()
104- .gap(px(10.))104+ .gap(px(space::MD))
105 .child(compact_field(palette, &self.filter))105 .child(compact_field(palette, &self.filter))
106 .child(106 .child(
107 Checkbox::new("keep_authors")107 Checkbox::new("keep_authors")
@@ -117,10 +117,10 @@ impl Render for Forward {
117 .child(117 .child(
118 div()118 div()
119 .id("forward_list")119 .id("forward_list")
120- .max_h(px(320.))120+ .max_h(px(size::POPOVER))
121 .flex()121 .flex()
122 .flex_col()122 .flex_col()
123- .gap(px(1.))123+ .gap(px(space::XXS))
124 .overflow_y_scroll()124 .overflow_y_scroll()
125 .children(rows),125 .children(rows),
126 )126 )
@@ -141,7 +141,7 @@ impl Yumush {
141 let forward = cx.new(|cx| Forward::new(yumush, selected, window, cx));141 let forward = cx.new(|cx| Forward::new(yumush, selected, window, cx));
142 142
143 window.open_dialog(cx, move |dialog, _, _| {143 window.open_dialog(cx, move |dialog, _, _| {
144- dialog.title("Forward").w(px(360.)).child(forward.clone())144+ dialog.title("Forward").w(px(size::SHEET)).child(forward.clone())
145 });145 });
146 }146 }
147 147
crates/client/src/gui/media_view.rsmodified+43 -45
@@ -1,3 +1,4 @@
1+use super::style::{radius, size, space, text};
1 use super::text;2 use super::text;
2 use common::model::Id;3 use common::model::Id;
3 use std::{4 use std::{
@@ -33,9 +34,9 @@ use crate::{
33 net::{Fail, NetworkHandle},34 net::{Fail, NetworkHandle},
34 };35 };
35 36
36-const IMAGE_BOX: (f32, f32) = (400., 300.);37+const IMAGE_BOX: (f32, f32) = (size::MEDIA, 300.);
37-const VIDEO_BOX: (f32, f32) = (480., 270.);38+const VIDEO_BOX: (f32, f32) = (size::WIDE, 270.);
38-const EMBED_IMAGE_BOX: (f32, f32) = (400., 225.);39+const EMBED_IMAGE_BOX: (f32, f32) = (size::MEDIA, 225.);
39 40
40 pub struct LoadedEmbed {41 pub struct LoadedEmbed {
41 embed: Embed,42 embed: Embed,
@@ -536,7 +537,7 @@ pub fn attachments(
536 return None;537 return None;
537 }538 }
538 Some(539 Some(
539- div().flex().flex_col().gap(px(6.)).children(540+ div().flex().flex_col().gap(px(space::SM)).children(
540 attachments541 attachments
541 .iter()542 .iter()
542 .map(|attachment| attachment_view(attachment, media, entity, palette)),543 .map(|attachment| attachment_view(attachment, media, entity, palette)),
@@ -585,7 +586,7 @@ fn image_view(
585 .id(format!("attachment_{}", attachment.id))586 .id(format!("attachment_{}", attachment.id))
586 .w(px(width))587 .w(px(width))
587 .h(px(height))588 .h(px(height))
588- .rounded(px(8.))589+ .rounded(px(radius::MD))
589 .overflow_hidden()590 .overflow_hidden()
590 .bg(palette.field)591 .bg(palette.field)
591 .cursor_pointer()592 .cursor_pointer()
@@ -603,12 +604,10 @@ fn card(palette: Palette) -> gpui_kit::Div {
603 .max_w(px(VIDEO_BOX.0))604 .max_w(px(VIDEO_BOX.0))
604 .flex()605 .flex()
605 .items_center()606 .items_center()
606- .gap(px(10.))607+ .gap(px(space::MD))
607- .px(px(12.))608+ .px(px(space::MD))
608- .py(px(10.))609+ .py(px(space::MD))
609- .rounded(px(8.))610+ .rounded(px(radius::MD))
610- .border_1()
611- .border_color(palette.border)
612 .bg(palette.panel)611 .bg(palette.panel)
613 }612 }
614 613
@@ -626,7 +625,7 @@ fn name_block(attachment: &Attachment, detail: String, palette: Palette) -> impl
626 )625 )
627 .child(626 .child(
628 div()627 div()
629- .text_size(text(12.))628+ .text_size(text(text::CAPTION))
630 .text_color(palette.muted)629 .text_color(palette.muted)
631 .child(detail),630 .child(detail),
632 )631 )
@@ -641,14 +640,14 @@ fn icon_button(
641 ) -> impl IntoElement {640 ) -> impl IntoElement {
642 clickable(id, palette, on_click)641 clickable(id, palette, on_click)
643 .tip(tip)642 .tip(tip)
644- .size(px(32.))643+ .size(px(size::CONTROL))
645 .flex_shrink_0()644 .flex_shrink_0()
646 .flex()645 .flex()
647 .items_center()646 .items_center()
648 .justify_center()647 .justify_center()
649- .rounded(px(6.))648+ .rounded(px(radius::MD))
650 .text_color(palette.text)649 .text_color(palette.text)
651- .child(Icon::new(icon).w(px(16.)).h(px(16.)))650+ .child(Icon::new(icon).size(px(size::ICON)))
652 }651 }
653 652
654 fn file_view(653 fn file_view(
@@ -659,8 +658,7 @@ fn file_view(
659 card(palette)658 card(palette)
660 .child(659 .child(
661 Icon::new(IconName::File)660 Icon::new(IconName::File)
662- .w(px(20.))661+ .size(px(size::ICON))
663- .h(px(20.))
664 .text_color(palette.muted),662 .text_color(palette.muted),
665 )663 )
666 .child(name_block(attachment, storage(attachment.size), palette))664 .child(name_block(attachment, storage(attachment.size), palette))
@@ -720,7 +718,7 @@ fn player_view(
720 this.child(waveform_view(attachment, media, entity, state, palette))718 this.child(waveform_view(attachment, media, entity, state, palette))
721 .child(719 .child(
722 div()720 div()
723- .text_size(text(12.))721+ .text_size(text(text::CAPTION))
724 .text_color(palette.muted)722 .text_color(palette.muted)
725 .child(detail.clone()),723 .child(detail.clone()),
726 )724 )
@@ -733,7 +731,7 @@ fn player_view(
733 Some(PlayState::Ready { seek, .. }) if !voice => Some(seek),731 Some(PlayState::Ready { seek, .. }) if !voice => Some(seek),
734 _ => None,732 _ => None,
735 },733 },
736- |this, seek| this.child(div().w(px(140.)).child(Slider::new(seek))),734+ |this, seek| this.child(div().w(px(size::THUMB)).child(Slider::new(seek))),
737 );735 );
738 736
739 let video = match state {737 let video = match state {
@@ -747,16 +745,16 @@ fn player_view(
747 div()745 div()
748 .flex()746 .flex()
749 .flex_col()747 .flex_col()
750- .gap(px(4.))748+ .gap(px(space::XS))
751 .when_some(video, |this, (frame, width, height)| {749 .when_some(video, |this, (frame, width, height)| {
752 let (width, height) = fit(Some(width), Some(height), VIDEO_BOX);750 let (width, height) = fit(Some(width), Some(height), VIDEO_BOX);
753 this.child(751 this.child(
754 div()752 div()
755 .w(px(width))753 .w(px(width))
756 .h(px(height))754 .h(px(height))
757- .rounded(px(8.))755+ .rounded(px(radius::MD))
758 .overflow_hidden()756 .overflow_hidden()
759- .bg(gpui_kit::black())757+ .bg(palette.tokens.ground())
760 .children(frame.clone().map(|frame| img(frame).size_full())),758 .children(frame.clone().map(|frame| img(frame).size_full())),
761 )759 )
762 })760 })
@@ -809,7 +807,7 @@ fn embed_view(loaded: &LoadedEmbed, palette: Palette) -> impl IntoElement {
809 div()807 div()
810 .max_w(px(EMBED_IMAGE_BOX.0))808 .max_w(px(EMBED_IMAGE_BOX.0))
811 .max_h(px(EMBED_IMAGE_BOX.1))809 .max_h(px(EMBED_IMAGE_BOX.1))
812- .rounded(px(6.))810+ .rounded(px(radius::MD))
813 .overflow_hidden()811 .overflow_hidden()
814 .child(812 .child(
815 img(image)813 img(image)
@@ -826,17 +824,17 @@ fn embed_view(loaded: &LoadedEmbed, palette: Palette) -> impl IntoElement {
826 .max_w(px(VIDEO_BOX.0))824 .max_w(px(VIDEO_BOX.0))
827 .flex()825 .flex()
828 .flex_col()826 .flex_col()
829- .gap(px(4.))827+ .gap(px(space::XS))
830- .pl(px(12.))828+ .pl(px(space::MD))
831- .pr(px(12.))829+ .pr(px(space::MD))
832- .py(px(10.))830+ .py(px(space::MD))
833- .rounded(px(6.))831+ .rounded(px(radius::MD))
834 .border_l_2()832 .border_l_2()
835 .border_color(palette.border)833 .border_color(palette.border)
836 .bg(palette.panel)834 .bg(palette.panel)
837 .children(embed.site.clone().map(|site| {835 .children(embed.site.clone().map(|site| {
838 div()836 div()
839- .text_size(text(12.))837+ .text_size(text(text::CAPTION))
840 .text_color(palette.muted)838 .text_color(palette.muted)
841 .child(site)839 .child(site)
842 }))840 }))
@@ -852,7 +850,7 @@ fn embed_view(loaded: &LoadedEmbed, palette: Palette) -> impl IntoElement {
852 }))850 }))
853 .children(embed.description.clone().map(|description| {851 .children(embed.description.clone().map(|description| {
854 div()852 div()
855- .text_size(text(13.))853+ .text_size(text(text::LABEL))
856 .text_color(palette.body)854 .text_color(palette.body)
857 .line_clamp(3)855 .line_clamp(3)
858 .child(description)856 .child(description)
@@ -872,24 +870,24 @@ pub fn pending_row(
872 div()870 div()
873 .flex()871 .flex()
874 .flex_wrap()872 .flex_wrap()
875- .gap(px(6.))873+ .gap(px(space::SM))
876- .pb(px(8.))874+ .pb(px(space::SM))
877 .children(media.pending.iter().map(|attachment| {875 .children(media.pending.iter().map(|attachment| {
878 let entity = entity.clone();876 let entity = entity.clone();
879 let attachment_id = attachment.id;877 let attachment_id = attachment.id;
880 div()878 div()
881 .flex()879 .flex()
882 .items_center()880 .items_center()
883- .gap(px(6.))881+ .gap(px(space::SM))
884- .pl(px(10.))882+ .pl(px(space::MD))
885- .pr(px(4.))883+ .pr(px(space::XS))
886- .py(px(4.))884+ .py(px(space::XS))
887- .rounded(px(6.))885+ .rounded(px(radius::MD))
888 .bg(palette.hover)886 .bg(palette.hover)
889- .text_size(text(12.))887+ .text_size(text(text::CAPTION))
890 .child(888 .child(
891 div()889 div()
892- .max_w(px(180.))890+ .max_w(px(size::SIDEBAR))
893 .truncate()891 .truncate()
894 .child(attachment.name.clone()),892 .child(attachment.name.clone()),
895 )893 )
@@ -904,20 +902,20 @@ pub fn pending_row(
904 },902 },
905 )903 )
906 .tip("Remove")904 .tip("Remove")
907- .size(px(18.))905+ .size(px(size::CHIP))
908 .flex()906 .flex()
909 .items_center()907 .items_center()
910 .justify_center()908 .justify_center()
911- .rounded(px(4.))909+ .rounded(px(radius::SM))
912- .child(Icon::new(IconName::Close).w(px(12.)).h(px(12.))),910+ .child(Icon::new(IconName::Close).size(px(size::ICON_SM))),
913 )911 )
914 }))912 }))
915 .when(media.uploading(), |this| {913 .when(media.uploading(), |this| {
916 this.child(914 this.child(
917 div()915 div()
918- .px(px(10.))916+ .px(px(space::MD))
919- .py(px(4.))917+ .py(px(space::XS))
920- .text_size(text(12.))918+ .text_size(text(text::CAPTION))
921 .text_color(palette.muted)919 .text_color(palette.muted)
922 .child("…"),920 .child("…"),
923 )921 )
crates/client/src/gui/message_actions.rsmodified+39 -39
@@ -25,6 +25,7 @@ use super::{
25 clickable,25 clickable,
26 composer::trigger_icon,26 composer::trigger_icon,
27 entity_action, millis_time, notify_error, pop_in, primary_button, sidebar,27 entity_action, millis_time, notify_error, pop_in, primary_button, sidebar,
28+ style::{radius, size, space, text},
28 widget::{field, icon_button, panel, spawn_done},29 widget::{field, icon_button, panel, spawn_done},
29 };30 };
30 31
@@ -39,7 +40,7 @@ pub fn reactions(
39 div()40 div()
40 .flex()41 .flex()
41 .flex_wrap()42 .flex_wrap()
42- .gap(px(4.))43+ .gap(px(space::XS))
43 .children(message.reactions.iter().map(|reaction| {44 .children(message.reactions.iter().map(|reaction| {
44 let mine = me_id45 let mine = me_id
45 .as_ref()46 .as_ref()
@@ -62,18 +63,18 @@ pub fn reactions(
62 )63 )
63 .flex()64 .flex()
64 .items_center()65 .items_center()
65- .gap(px(4.))66+ .gap(px(space::XS))
66- .h(px(22.))67+ .h(px(size::CHIP))
67- .px(px(6.))68+ .px(px(space::SM))
68 .rounded_full()69 .rounded_full()
69 .border_1()70 .border_1()
70 .border_color(if mine { palette.accent } else { palette.border })71 .border_color(if mine { palette.accent } else { palette.border })
71 .bg(if mine {72 .bg(if mine {
72- palette.accent.opacity(0.15)73+ palette.tokens.press()
73 } else {74 } else {
74 palette.panel75 palette.panel
75 })76 })
76- .text_size(text(12.))77+ .text_size(text(text::CAPTION))
77 .child(chip_emoji)78 .child(chip_emoji)
78 .child(div().text_color(palette.muted).child(count.to_string()))79 .child(div().text_color(palette.muted).child(count.to_string()))
79 }))80 }))
@@ -102,8 +103,8 @@ pub fn react_popover(
102 "react_list",103 "react_list",
103 panel(palette)104 panel(palette)
104 .flex()105 .flex()
105- .gap(px(2.))106+ .gap(px(space::XXS))
106- .p(px(4.))107+ .p(px(space::XS))
107 .children(REACTIONS.map(|emoji| {108 .children(REACTIONS.map(|emoji| {
108 let entity = entity.clone();109 let entity = entity.clone();
109 let popover = popover.clone();110 let popover = popover.clone();
@@ -122,12 +123,12 @@ pub fn react_popover(
122 });123 });
123 },124 },
124 )125 )
125- .size(px(28.))126+ .size(px(size::CONTROL_SM))
126 .flex()127 .flex()
127 .items_center()128 .items_center()
128 .justify_center()129 .justify_center()
129- .rounded(px(6.))130+ .rounded(px(radius::MD))
130- .text_size(text(16.))131+ .text_size(text(text::BODY))
131 .child(emoji)132 .child(emoji)
132 })),133 })),
133 Anchor::TopRight,134 Anchor::TopRight,
@@ -158,13 +159,13 @@ pub fn quote_line(message: &Message, chat: &Chat, palette: Palette) -> Option<im
158 div()159 div()
159 .flex()160 .flex()
160 .items_center()161 .items_center()
161- .gap(px(6.))162+ .gap(px(space::SM))
162- .pl(px(8.))163+ .pl(px(space::SM))
163 .border_l_2()164 .border_l_2()
164- .border_color(palette.accent.opacity(0.6))165+ .border_color(palette.border)
165- .text_size(text(12.))166+ .text_size(text(text::CAPTION))
166 .text_color(palette.muted)167 .text_color(palette.muted)
167- .children(author.map(|user| avatar(palette, user, px(14.), text(7.), &chat.avatars)))168+ .children(author.map(|user| avatar(palette, user, px(size::ICON_SM), text(text::CAPTION), &chat.avatars)))
168 .children(author.map(|user| {169 .children(author.map(|user| {
169 div()170 div()
170 .flex_shrink_0()171 .flex_shrink_0()
@@ -184,7 +185,7 @@ pub fn quote_line(message: &Message, chat: &Chat, palette: Palette) -> Option<im
184 185
185 pub fn selection_mark(selected: bool, palette: Palette) -> impl IntoElement {186 pub fn selection_mark(selected: bool, palette: Palette) -> impl IntoElement {
186 div()187 div()
187- .size(px(16.))188+ .size(px(size::ICON))
188 .flex_shrink_0()189 .flex_shrink_0()
189 .flex()190 .flex()
190 .items_center()191 .items_center()
@@ -203,8 +204,7 @@ pub fn selection_mark(selected: bool, palette: Palette) -> impl IntoElement {
203 })204 })
204 .children(selected.then(|| {205 .children(selected.then(|| {
205 Icon::new(IconName::Check)206 Icon::new(IconName::Check)
206- .w(px(10.))207+ .size(px(size::ICON_SM))
207- .h(px(10.))
208 .text_color(palette.on_accent)208 .text_color(palette.on_accent)
209 }))209 }))
210 }210 }
@@ -213,7 +213,7 @@ pub fn pin_mark(palette: Palette) -> impl IntoElement {
213 div()213 div()
214 .flex_shrink_0()214 .flex_shrink_0()
215 .text_color(palette.muted)215 .text_color(palette.muted)
216- .child(Icon::new(IconName::Pin).w(px(12.)).h(px(12.)))216+ .child(Icon::new(IconName::Pin).size(px(size::ICON_SM)))
217 }217 }
218 218
219 struct Hit {219 struct Hit {
@@ -245,11 +245,11 @@ fn jump_row(
245 },245 },
246 )246 )
247 .flex()247 .flex()
248- .gap(px(6.))248+ .gap(px(space::SM))
249- .px(px(8.))249+ .px(px(space::SM))
250- .py(px(4.))250+ .py(px(space::XS))
251- .rounded(px(6.))251+ .rounded(px(radius::MD))
252- .text_size(text(12.))252+ .text_size(text(text::CAPTION))
253 .child(253 .child(
254 div()254 div()
255 .flex_shrink_0()255 .flex_shrink_0()
@@ -290,11 +290,11 @@ pub fn search_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) ->
290 pop_in(290 pop_in(
291 "search_list",291 "search_list",
292 panel(palette)292 panel(palette)
293- .w(px(320.))293+ .w(px(size::POPOVER))
294- .p(px(4.))294+ .p(px(space::XS))
295 .flex()295 .flex()
296 .flex_col()296 .flex_col()
297- .gap(px(4.))297+ .gap(px(space::XS))
298 .child(sidebar::input_box(&input, palette))298 .child(sidebar::input_box(&input, palette))
299 .children(hits.iter().map(|hit| {299 .children(hits.iter().map(|hit| {
300 jump_row("search_hit", hit, &entity, &popover, palette)300 jump_row("search_hit", hit, &entity, &popover, palette)
@@ -336,11 +336,11 @@ pub fn pins_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
336 pop_in(336 pop_in(
337 "pins_list",337 "pins_list",
338 panel(palette)338 panel(palette)
339- .w(px(260.))339+ .w(px(size::POPOVER))
340- .p(px(4.))340+ .p(px(space::XS))
341 .flex()341 .flex()
342 .flex_col()342 .flex_col()
343- .gap(px(2.))343+ .gap(px(space::XXS))
344 .children(pins.iter().map(|hit| {344 .children(pins.iter().map(|hit| {
345 jump_row("pin_hit", hit, &entity, &popover, palette).child(345 jump_row("pin_hit", hit, &entity, &popover, palette).child(
346 div()346 div()
@@ -375,8 +375,8 @@ pub fn actions(
375 panel(palette)375 panel(palette)
376 .flex()376 .flex()
377 .items_center()377 .items_center()
378- .gap(px(2.))378+ .gap(px(space::XXS))
379- .p(px(2.))379+ .p(px(space::XXS))
380 .when(!armed, |this| this.invisible())380 .when(!armed, |this| this.invisible())
381 .group_hover(group, |style| style.visible())381 .group_hover(group, |style| style.visible())
382 .child(action(382 .child(action(
@@ -449,7 +449,7 @@ pub fn actions(
449 )449 )
450 .when(armed, |this| {450 .when(armed, |this| {
451 this.text_color(palette.danger)451 this.text_color(palette.danger)
452- .bg(palette.danger.opacity(0.15))452+ .bg(palette.tokens.press())
453 })453 })
454 }))454 }))
455 }455 }
@@ -462,7 +462,7 @@ pub fn report_bar(
462 div()462 div()
463 .flex()463 .flex()
464 .items_center()464 .items_center()
465- .gap(px(6.))465+ .gap(px(space::SM))
466 .child(div().flex_1().min_w_0().child(field(palette, reason)))466 .child(div().flex_1().min_w_0().child(field(palette, reason)))
467 .child(467 .child(
468 primary_button(468 primary_button(
@@ -470,11 +470,11 @@ pub fn report_bar(
470 palette,470 palette,
471 entity_action(entity, |yumush, window, cx| yumush.send_report(window, cx)),471 entity_action(entity, |yumush, window, cx| yumush.send_report(window, cx)),
472 )472 )
473- .h(px(28.))473+ .h(px(size::CONTROL_SM))
474- .px(px(10.))474+ .px(px(space::MD))
475 .flex()475 .flex()
476 .items_center()476 .items_center()
477- .rounded(px(6.))477+ .rounded(px(radius::MD))
478 .child("Send"),478 .child("Send"),
479 )479 )
480 }480 }
@@ -586,5 +586,5 @@ fn action(
586 entity.update(cx, |yumush, cx| run(yumush, message_id, window, cx));586 entity.update(cx, |yumush, cx| run(yumush, message_id, window, cx));
587 },587 },
588 )588 )
589- .size(px(24.))589+ .size(px(size::CONTROL_SM))
590 }590 }
crates/client/src/gui/parts.rsmodified+1 -3
@@ -19,7 +19,6 @@ pub enum Text {
19 Ui,19 Ui,
20 Body,20 Body,
21 Title,21 Title,
22- Display,
23 }22 }
24 23
25 impl Text {24 impl Text {
@@ -30,7 +29,6 @@ impl Text {
30 Text::Ui => text::UI,29 Text::Ui => text::UI,
31 Text::Body => text::BODY,30 Text::Body => text::BODY,
32 Text::Title => text::TITLE,31 Text::Title => text::TITLE,
33- Text::Display => text::DISPLAY,
34 }32 }
35 }33 }
36 }34 }
@@ -56,7 +54,7 @@ impl Ink {
56 54
57 pub fn words(content: impl Into<SharedString>, style: Text, ink: Ink, t: Tokens) -> Div {55 pub fn words(content: impl Into<SharedString>, style: Text, ink: Ink, t: Tokens) -> Div {
58 let weight = match style {56 let weight = match style {
59- Text::Title | Text::Display => FontWeight::SEMIBOLD,57+ Text::Title => FontWeight::SEMIBOLD,
60 _ => FontWeight::NORMAL,58 _ => FontWeight::NORMAL,
61 };59 };
62 div()60 div()
crates/client/src/gui/poll.rsmodified+52 -50
@@ -12,6 +12,7 @@ use super::{
12 Palette, Tooltip as _, Trigger, Yumush, avatar,12 Palette, Tooltip as _, Trigger, Yumush, avatar,
13 chat::Chat,13 chat::Chat,
14 clickable, hoverable, pop_in, text,14 clickable, hoverable, pop_in, text,
15+ style::{radius, size, space, text},
15 widget::{icon_button, panel, spawn_done},16 widget::{icon_button, panel, spawn_done},
16 };17 };
17 18
@@ -61,15 +62,15 @@ fn status_icon(
61 .tip(tip)62 .tip(tip)
62 .flex_shrink_0()63 .flex_shrink_0()
63 .text_color(palette.muted)64 .text_color(palette.muted)
64- .child(Icon::new(icon).w(px(12.)).h(px(12.)))65+ .child(Icon::new(icon).size(px(size::ICON_SM)))
65 }66 }
66 67
67 fn voters_label(voters: usize) -> Div {68 fn voters_label(voters: usize) -> Div {
68 div()69 div()
69 .flex()70 .flex()
70 .items_center()71 .items_center()
71- .gap(px(4.))72+ .gap(px(space::XS))
72- .child(Icon::new(IconName::Users).w(px(12.)).h(px(12.)))73+ .child(Icon::new(IconName::Users).size(px(size::ICON_SM)))
73 .child(format!("{voters}"))74 .child(format!("{voters}"))
74 }75 }
75 76
@@ -97,11 +98,11 @@ fn voters_popover(key: &str, poll: &Poll, entity: &Entity<Yumush>, palette: Pale
97 .flex_col()98 .flex_col()
98 .child(99 .child(
99 div()100 div()
100- .h(px(26.))101+ .h(px(size::CONTROL_SM))
101 .flex()102 .flex()
102 .items_center()103 .items_center()
103- .gap(px(8.))104+ .gap(px(space::SM))
104- .text_size(text(11.))105+ .text_size(text(text::CAPTION))
105 .text_color(palette.muted)106 .text_color(palette.muted)
106 .child(107 .child(
107 div()108 div()
@@ -119,12 +120,12 @@ fn voters_popover(key: &str, poll: &Poll, entity: &Entity<Yumush>, palette: Pale
119 .children(option.voter_ids.iter().filter_map(|id| {120 .children(option.voter_ids.iter().filter_map(|id| {
120 chat.author(*id).map(|user| {121 chat.author(*id).map(|user| {
121 div()122 div()
122- .h(px(26.))123+ .h(px(size::CONTROL_SM))
123 .flex()124 .flex()
124 .items_center()125 .items_center()
125- .gap(px(8.))126+ .gap(px(space::SM))
126- .text_size(text(12.))127+ .text_size(text(text::CAPTION))
127- .child(avatar(palette, user, px(18.), text(8.), &chat.avatars))128+ .child(avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &chat.avatars))
128 .child(129 .child(
129 div()130 div()
130 .flex_1()131 .flex_1()
@@ -138,11 +139,11 @@ fn voters_popover(key: &str, poll: &Poll, entity: &Entity<Yumush>, palette: Pale
138 pop_in(139 pop_in(
139 list.clone(),140 list.clone(),
140 panel(palette)141 panel(palette)
141- .w(px(260.))142+ .w(px(size::SIDEBAR))
142 .id(list.clone())143 .id(list.clone())
143- .max_h(px(320.))144+ .max_h(px(size::POPOVER))
144 .overflow_y_scroll()145 .overflow_y_scroll()
145- .p(px(6.))146+ .p(px(space::SM))
146 .flex()147 .flex()
147 .flex_col()148 .flex_col()
148 .children(rows),149 .children(rows),
@@ -218,17 +219,17 @@ pub fn poll_card(
218 None => div().id(id),219 None => div().id(id),
219 }220 }
220 .relative()221 .relative()
221- .h(px(36.))222+ .h(px(size::CONTROL))
222- .px(px(10.))223+ .px(px(space::MD))
223 .flex()224 .flex()
224 .items_center()225 .items_center()
225- .gap(px(8.))226+ .gap(px(space::SM))
226- .rounded(px(8.))227+ .rounded(px(radius::MD))
227 .border_1()228 .border_1()
228 .border_color(if picked {229 .border_color(if picked {
229 palette.accent230 palette.accent
230 } else {231 } else {
231- palette.accent.opacity(0.)232+ palette.field
232 })233 })
233 .overflow_hidden()234 .overflow_hidden()
234 .bg(palette.field)235 .bg(palette.field)
@@ -239,12 +240,16 @@ pub fn poll_card(
239 .top_0()240 .top_0()
240 .h_full()241 .h_full()
241 .w(relative(share as f32 / 100.))242 .w(relative(share as f32 / 100.))
242- .bg(palette.accent.opacity(if picked { 0.35 } else { 0.15 })),243+ .bg(if picked {
244+ palette.tokens.press()
245+ } else {
246+ palette.hover
247+ }),
243 )248 )
244 .child(249 .child(
245 div()250 div()
246 .flex_shrink_0()251 .flex_shrink_0()
247- .size(px(14.))252+ .size(px(size::ICON_SM))
248 .flex()253 .flex()
249 .items_center()254 .items_center()
250 .justify_center()255 .justify_center()
@@ -259,7 +264,7 @@ pub fn poll_card(
259 marker264 marker
260 .bg(palette.accent)265 .bg(palette.accent)
261 .text_color(palette.on_accent)266 .text_color(palette.on_accent)
262- .child(Icon::new(IconName::Check).w(px(10.)).h(px(10.)))267+ .child(Icon::new(IconName::Check).size(px(size::ICON_SM)))
263 }),268 }),
264 )269 )
265 .child(270 .child(
@@ -280,17 +285,17 @@ pub fn poll_card(
280 .enumerate()285 .enumerate()
281 .filter_map(|(index, id)| {286 .filter_map(|(index, id)| {
282 chat.author(*id).map(|user| {287 chat.author(*id).map(|user| {
283- avatar(palette, user, px(18.), text(8.), &chat.avatars)288+ avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &chat.avatars)
284 .border_2()289 .border_2()
285 .border_color(palette.panel)290 .border_color(palette.panel)
286- .when(index > 0, |el| el.ml(px(-6.)))291+ .when(index > 0, |el| el.ml(px(-space::SM)))
287 })292 })
288 }),293 }),
289 )294 )
290 .children((voters_here.len() > 3).then(|| {295 .children((voters_here.len() > 3).then(|| {
291 div()296 div()
292- .ml(px(4.))297+ .ml(px(space::XS))
293- .text_size(text(11.))298+ .text_size(text(text::CAPTION))
294 .text_color(palette.muted)299 .text_color(palette.muted)
295 .child(format!("+{}", voters_here.len() - 3))300 .child(format!("+{}", voters_here.len() - 3))
296 }))301 }))
@@ -298,7 +303,7 @@ pub fn poll_card(
298 .child(303 .child(
299 div()304 div()
300 .flex_shrink_0()305 .flex_shrink_0()
301- .text_size(text(12.))306+ .text_size(text(text::CAPTION))
302 .font_weight(FontWeight::SEMIBOLD)307 .font_weight(FontWeight::SEMIBOLD)
303 .text_color(if picked { palette.text } else { palette.muted })308 .text_color(if picked { palette.text } else { palette.muted })
304 .child(format!("{share}%")),309 .child(format!("{share}%")),
@@ -315,8 +320,8 @@ pub fn poll_card(
315 div()320 div()
316 .flex()321 .flex()
317 .items_center()322 .items_center()
318- .gap(px(4.))323+ .gap(px(space::XS))
319- .child(Icon::new(IconName::Timer).w(px(12.)).h(px(12.)))324+ .child(Icon::new(IconName::Timer).size(px(size::ICON_SM)))
320 .child(remaining(end))325 .child(remaining(end))
321 });326 });
322 327
@@ -324,14 +329,14 @@ pub fn poll_card(
324 .flex()329 .flex()
325 .items_center()330 .items_center()
326 .justify_between()331 .justify_between()
327- .text_size(text(12.))332+ .text_size(text(text::CAPTION))
328 .text_color(palette.muted)333 .text_color(palette.muted)
329 .child(voters_view)334 .child(voters_view)
330 .child(335 .child(
331 div()336 div()
332 .flex()337 .flex()
333 .items_center()338 .items_center()
334- .gap(px(8.))339+ .gap(px(space::SM))
335 .children(timer)340 .children(timer)
336 .children(close_id.map(|close_id| {341 .children(close_id.map(|close_id| {
337 let close_entity = entity.clone();342 let close_entity = entity.clone();
@@ -357,25 +362,23 @@ pub fn poll_card(
357 div()362 div()
358 .flex()363 .flex()
359 .flex_col()364 .flex_col()
360- .gap(px(8.))365+ .gap(px(space::SM))
361- .p(px(14.))366+ .p(px(space::LG))
362- .w(px(360.))367+ .w(px(size::SHEET))
363 .max_w_full()368 .max_w_full()
364- .rounded(px(12.))369+ .rounded(px(radius::LG))
365- .border_1()
366- .border_color(palette.border)
367 .bg(palette.panel)370 .bg(palette.panel)
368 .child(371 .child(
369 div()372 div()
370 .flex()373 .flex()
371 .items_start()374 .items_start()
372 .justify_between()375 .justify_between()
373- .gap(px(8.))376+ .gap(px(space::SM))
374 .child(377 .child(
375 div()378 div()
376 .min_w_0()379 .min_w_0()
377 .font_weight(FontWeight::SEMIBOLD)380 .font_weight(FontWeight::SEMIBOLD)
378- .text_size(text(15.))381+ .text_size(text(text::UI))
379 .child(poll.question.clone()),382 .child(poll.question.clone()),
380 )383 )
381 .child(384 .child(
@@ -383,7 +386,7 @@ pub fn poll_card(
383 .flex_shrink_0()386 .flex_shrink_0()
384 .flex()387 .flex()
385 .items_center()388 .items_center()
386- .gap(px(6.))389+ .gap(px(space::SM))
387 .child(status_icon(390 .child(status_icon(
388 format!("poll_public_{key}_{}", poll.public),391 format!("poll_public_{key}_{}", poll.public),
389 visibility,392 visibility,
@@ -438,9 +441,9 @@ impl Yumush {
438 div()441 div()
439 .flex()442 .flex()
440 .flex_col()443 .flex_col()
441- .gap(px(6.))444+ .gap(px(space::SM))
442- .px(px(16.))445+ .px(px(space::LG))
443- .py(px(8.))446+ .py(px(space::SM))
444 .border_b_1()447 .border_b_1()
445 .border_color(palette.border)448 .border_color(palette.border)
446 .bg(palette.panel)449 .bg(palette.panel)
@@ -448,7 +451,7 @@ impl Yumush {
448 div()451 div()
449 .flex()452 .flex()
450 .items_center()453 .items_center()
451- .gap(px(8.))454+ .gap(px(space::SM))
452 .child(455 .child(
453 clickable("poll_banner_toggle", palette, move |_, cx| {456 clickable("poll_banner_toggle", palette, move |_, cx| {
454 toggle.update(cx, |yumush, cx| {457 toggle.update(cx, |yumush, cx| {
@@ -460,13 +463,13 @@ impl Yumush {
460 .flex_1()463 .flex_1()
461 .min_w_0()464 .min_w_0()
462 .items_center()465 .items_center()
463- .gap(px(8.))466+ .gap(px(space::SM))
464- .text_size(text(12.))467+ .text_size(text(text::CAPTION))
465 .child(468 .child(
466 div()469 div()
467 .flex_shrink_0()470 .flex_shrink_0()
468 .text_color(palette.muted)471 .text_color(palette.muted)
469- .child(Icon::new(IconName::ChartBar).w(px(14.)).h(px(14.))),472+ .child(Icon::new(IconName::ChartBar).size(px(size::ICON_SM))),
470 )473 )
471 .child(474 .child(
472 div()475 div()
@@ -488,8 +491,7 @@ impl Yumush {
488 } else {491 } else {
489 IconName::ChevronDown492 IconName::ChevronDown
490 })493 })
491- .w(px(14.))494+ .size(px(size::ICON_SM)),
492- .h(px(14.)),
493 ),495 ),
494 ),496 ),
495 )497 )
@@ -497,8 +499,8 @@ impl Yumush {
497 div()499 div()
498 .flex()500 .flex()
499 .items_center()501 .items_center()
500- .gap(px(2.))502+ .gap(px(space::XXS))
501- .text_size(text(11.))503+ .text_size(text(text::CAPTION))
502 .text_color(palette.muted)504 .text_color(palette.muted)
503 .child(page_button(505 .child(page_button(
504 "poll_page_back",506 "poll_page_back",
crates/client/src/gui/profile.rsmodified+26 -23
@@ -28,6 +28,9 @@ use super::{
28 DAY_YEAR, Palette, Trigger, Yumush, avatar, clickable, entity_action, input_dialog,28 DAY_YEAR, Palette, Trigger, Yumush, avatar, clickable, entity_action, input_dialog,
29 millis_time, notify_error, palette, pop_in, presence_color, rank_tag, swap_in, text,29 millis_time, notify_error, palette, pop_in, presence_color, rank_tag, swap_in, text,
30 };30 };
31+use super::style::{radius, size, space, stroke, text};
32+
33+const ACCOUNTS_MAX_H: f32 = 180.;
31 34
32 #[derive(Debug, Clone, Copy, PartialEq, Eq)]35 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
33 enum Removal {36 enum Removal {
@@ -220,23 +223,23 @@ impl Card {
220 rows.extend(self.moderation_rows(entity, &popover, palette));223 rows.extend(self.moderation_rows(entity, &popover, palette));
221 rows224 rows
222 };225 };
223- let divider = (!rows.is_empty()).then(|| div().h(px(1.)).my(px(4.)).bg(palette.border));226+ let divider = (!rows.is_empty()).then(|| div().h(px(stroke::LINE)).my(px(space::XS)).bg(palette.border));
224 227
225 panel(palette)228 panel(palette)
226- .w(px(260.))229+ .w(px(size::SIDEBAR))
227- .p(px(16.))230+ .p(px(space::LG))
228 .flex()231 .flex()
229 .flex_col()232 .flex_col()
230- .gap(px(10.))233+ .gap(px(space::MD))
231- .child(avatar(palette, &self.user, px(48.), text(18.), avatars))234+ .child(avatar(palette, &self.user, px(size::AVATAR_LG), text(text::BODY), avatars))
232 .child(235 .child(
233 div()236 div()
234 .flex()237 .flex()
235 .items_center()238 .items_center()
236- .gap(px(6.))239+ .gap(px(space::SM))
237 .child(240 .child(
238 div()241 div()
239- .text_size(text(15.))242+ .text_size(text(text::UI))
240 .font_weight(FontWeight::SEMIBOLD)243 .font_weight(FontWeight::SEMIBOLD)
241 .child(self.user.username.clone()),244 .child(self.user.username.clone()),
242 )245 )
@@ -246,21 +249,21 @@ impl Card {
246 div()249 div()
247 .flex()250 .flex()
248 .items_center()251 .items_center()
249- .gap(px(6.))252+ .gap(px(space::SM))
250- .text_size(text(12.))253+ .text_size(text(text::CAPTION))
251 .text_color(palette.muted)254 .text_color(palette.muted)
252 .child(presence_dot(self.presence, palette))255 .child(presence_dot(self.presence, palette))
253 .child(self.presence.label())256 .child(self.presence.label())
254 }))257 }))
255 .children((!self.user.status.is_empty()).then(|| {258 .children((!self.user.status.is_empty()).then(|| {
256 div()259 div()
257- .text_size(text(12.))260+ .text_size(text(text::CAPTION))
258 .text_color(palette.muted)261 .text_color(palette.muted)
259 .child(self.user.status.clone())262 .child(self.user.status.clone())
260 }))263 }))
261 .child(264 .child(
262 div()265 div()
263- .text_size(text(12.))266+ .text_size(text(text::CAPTION))
264 .text_color(palette.muted)267 .text_color(palette.muted)
265 .child(format!(268 .child(format!(
266 "Joined {}",269 "Joined {}",
@@ -271,12 +274,12 @@ impl Card {
271 div()274 div()
272 .flex()275 .flex()
273 .items_center()276 .items_center()
274- .gap(px(8.))277+ .gap(px(space::SM))
275- .text_size(text(12.))278+ .text_size(text(text::CAPTION))
276 .text_color(palette.muted)279 .text_color(palette.muted)
277- .child(Icon::new(IconName::Volume2).w(px(14.)).h(px(14.)))280+ .child(Icon::new(IconName::Volume2).size(px(size::ICON_SM)))
278 .child(Slider::new(&slider).flex_1())281 .child(Slider::new(&slider).flex_1())
279- .child(div().w(px(36.)).text_right().child(format!("{volume:.0}%")))282+ .child(div().w(px(size::CONTROL)).text_right().child(format!("{volume:.0}%")))
280 }))283 }))
281 .children(284 .children(
282 self.reporting285 self.reporting
@@ -285,7 +288,7 @@ impl Card {
285 .children(divider)288 .children(divider)
286 .child(swap_in(289 .child(swap_in(
287 ("profile_rows", self.card_menu as usize),290 ("profile_rows", self.card_menu as usize),
288- div().flex().flex_col().gap(px(10.)).children(rows),291+ div().flex().flex_col().gap(px(space::MD)).children(rows),
289 self.card_menu != CardMenu::Main,292 self.card_menu != CardMenu::Main,
290 ))293 ))
291 }294 }
@@ -473,7 +476,7 @@ fn accounts_rows(
473 .into_any_element(),476 .into_any_element(),
474 div()477 div()
475 .id("profile_accounts")478 .id("profile_accounts")
476- .max_h(px(180.))479+ .max_h(px(ACCOUNTS_MAX_H))
477 .overflow_y_scroll()480 .overflow_y_scroll()
478 .flex()481 .flex()
479 .flex_col()482 .flex_col()
@@ -535,7 +538,7 @@ fn card_menu_action(
535 538
536 fn presence_dot(presence: Presence, palette: Palette) -> Div {539 fn presence_dot(presence: Presence, palette: Palette) -> Div {
537 div()540 div()
538- .size(px(8.))541+ .size(px(space::SM))
539 .rounded_full()542 .rounded_full()
540 .bg(presence_color(presence, palette))543 .bg(presence_color(presence, palette))
541 }544 }
@@ -576,7 +579,7 @@ fn delete_user_action(
576 }579 }
577 580
578 fn menu_icon(icon: IconName) -> Icon {581 fn menu_icon(icon: IconName) -> Icon {
579- Icon::new(icon).w(px(14.)).h(px(14.))582+ Icon::new(icon).size(px(size::ICON_SM))
580 }583 }
581 584
582 fn menu_row(585 fn menu_row(
@@ -588,12 +591,12 @@ fn menu_row(
588 on_click: impl Fn(&mut Window, &mut App) + 'static,591 on_click: impl Fn(&mut Window, &mut App) + 'static,
589 ) -> Stateful<Div> {592 ) -> Stateful<Div> {
590 clickable(id, palette, on_click)593 clickable(id, palette, on_click)
591- .h(px(30.))594+ .h(px(size::CONTROL))
592- .px(px(8.))595+ .px(px(space::SM))
593 .flex()596 .flex()
594 .items_center()597 .items_center()
595- .gap(px(8.))598+ .gap(px(space::SM))
596- .rounded(px(6.))599+ .rounded(px(radius::MD))
597 .text_color(color)600 .text_color(color)
598 .child(leading)601 .child(leading)
599 .child(label.into())602 .child(label.into())
crates/client/src/gui/settings_page.rsmodified+65 -68
@@ -24,7 +24,7 @@ use super::{
24 widget::{field, icon_button},24 widget::{field, icon_button},
25 };25 };
26 use crate::{26 use crate::{
27- gui::style::Theme,27+ gui::style::{Theme, radius, size, space, stroke, text},
28 settings::{self, FontSize},28 settings::{self, FontSize},
29 };29 };
30 30
@@ -41,7 +41,7 @@ impl Yumush {
41 picture_card(41 picture_card(
42 Picture {42 Picture {
43 id: "avatar_picker",43 id: "avatar_picker",
44- image: avatar(palette, user, px(64.), text(24.), &self.chat.avatars),44+ image: avatar(palette, user, px(size::AVATAR_LG), text(text::TITLE), &self.chat.avatars),
45 title: user.username.clone(),45 title: user.username.clone(),
46 subtitle: user.status.clone(),46 subtitle: user.status.clone(),
47 removable: user.avatar_id.is_some(),47 removable: user.avatar_id.is_some(),
@@ -307,11 +307,11 @@ pub(super) fn header(
307 let entity = entity.clone();307 let entity = entity.clone();
308 308
309 div()309 div()
310- .h(px(44.))310+ .h(px(size::ROW))
311- .px(px(12.))311+ .px(px(space::MD))
312 .flex()312 .flex()
313 .items_center()313 .items_center()
314- .gap(px(8.))314+ .gap(px(space::SM))
315 .border_b_1()315 .border_b_1()
316 .border_color(palette.border)316 .border_color(palette.border)
317 .child(icon_button(317 .child(icon_button(
@@ -350,46 +350,39 @@ pub(super) fn page(
350 .child(350 .child(
351 div()351 div()
352 .w_full()352 .w_full()
353- .max_w(px(600.))353+ .max_w(px(size::PAGE))
354- .px(px(24.))354+ .px(px(space::XL))
355- .py(px(32.))355+ .py(px(space::XXL))
356 .flex()356 .flex()
357 .flex_col()357 .flex_col()
358- .gap(px(28.))358+ .gap(px(space::XXL))
359 .children(sections),359 .children(sections),
360 ),360 ),
361 )361 )
362 }362 }
363 363
364 pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) -> impl IntoElement {364 pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) -> impl IntoElement {
365- card(title, palette.muted, palette.border, palette, rows)365+ card(title, palette.muted, palette, rows)
366 }366 }
367 367
368 pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> impl IntoElement {368 pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> impl IntoElement {
369- card(369+ card("Danger zone", palette.danger, palette, rows)
370- "Danger zone",
371- palette.danger,
372- palette.danger.opacity(0.35),
373- palette,
374- rows,
375- )
376 }370 }
377 371
378 fn card(372 fn card(
379 title: &'static str,373 title: &'static str,
380 title_color: Hsla,374 title_color: Hsla,
381- border: Hsla,
382 palette: Palette,375 palette: Palette,
383 rows: Vec<Div>,376 rows: Vec<Div>,
384 ) -> impl IntoElement {377 ) -> impl IntoElement {
385 div()378 div()
386 .flex()379 .flex()
387 .flex_col()380 .flex_col()
388- .gap(px(8.))381+ .gap(px(space::SM))
389 .child(382 .child(
390 div()383 div()
391- .px(px(2.))384+ .px(px(space::XXS))
392- .text_size(text(12.))385+ .text_size(text(text::CAPTION))
393 .font_weight(FontWeight::MEDIUM)386 .font_weight(FontWeight::MEDIUM)
394 .text_color(title_color)387 .text_color(title_color)
395 .child(title),388 .child(title),
@@ -398,10 +391,6 @@ fn card(
398 div()391 div()
399 .flex()392 .flex()
400 .flex_col()393 .flex_col()
401- .rounded(px(10.))
402- .border_1()
403- .border_color(border)
404- .bg(palette.panel)
405 .children(rows.into_iter().enumerate().map(|(index, row)| {394 .children(rows.into_iter().enumerate().map(|(index, row)| {
406 row.when(index > 0, |row| {395 row.when(index > 0, |row| {
407 row.border_t_1().border_color(palette.border)396 row.border_t_1().border_color(palette.border)
@@ -429,13 +418,13 @@ pub(super) fn text_row(
429 let save = editable.save;418 let save = editable.save;
430 419
431 div()420 div()
432- .p(px(12.))421+ .p(px(space::MD))
433 .flex()422 .flex()
434 .flex_col()423 .flex_col()
435- .gap(px(6.))424+ .gap(px(space::SM))
436 .child(425 .child(
437 div()426 div()
438- .text_size(text(12.))427+ .text_size(text(text::CAPTION))
439 .text_color(palette.muted)428 .text_color(palette.muted)
440 .child(editable.label),429 .child(editable.label),
441 )430 )
@@ -443,18 +432,18 @@ pub(super) fn text_row(
443 div()432 div()
444 .flex()433 .flex()
445 .items_center()434 .items_center()
446- .gap(px(8.))435+ .gap(px(space::SM))
447 .child(field(palette, editable.input).flex_1())436 .child(field(palette, editable.input).flex_1())
448 .when(dirty, |this| {437 .when(dirty, |this| {
449 this.child(438 this.child(
450 primary_button(editable.id, palette, move |window, cx| {439 primary_button(editable.id, palette, move |window, cx| {
451 entity.update(cx, |yumush, cx| save(yumush, window, cx));440 entity.update(cx, |yumush, cx| save(yumush, window, cx));
452 })441 })
453- .h(px(32.))442+ .h(px(size::CONTROL))
454- .px(px(14.))443+ .px(px(space::LG))
455 .flex()444 .flex()
456 .items_center()445 .items_center()
457- .rounded(px(8.))446+ .rounded(px(radius::MD))
458 .font_weight(FontWeight::MEDIUM)447 .font_weight(FontWeight::MEDIUM)
459 .child("Save"),448 .child("Save"),
460 )449 )
@@ -486,19 +475,14 @@ pub(super) fn picture_card(picture: Picture, entity: &Entity<Yumush>, palette: P
486 let remove_entity = entity.clone();475 let remove_entity = entity.clone();
487 476
488 div()477 div()
489- .p(px(16.))478+ .p(px(space::LG))
490 .flex()479 .flex()
491 .items_center()480 .items_center()
492- .gap(px(16.))481+ .gap(px(space::LG))
493- .rounded(px(10.))
494- .border_1()
495- .border_color(palette.border)
496- .bg(palette.panel)
497 .child(482 .child(
498 div()483 div()
499 .id(id)484 .id(id)
500 .cursor_pointer()485 .cursor_pointer()
501- .hover(|style| style.opacity(0.8))
502 .on_click(move |_, window, cx| {486 .on_click(move |_, window, cx| {
503 picture_entity.update(cx, |yumush, cx| upload(yumush, window, cx));487 picture_entity.update(cx, |yumush, cx| upload(yumush, window, cx));
504 })488 })
@@ -511,10 +495,10 @@ pub(super) fn picture_card(picture: Picture, entity: &Entity<Yumush>, palette: P
511 .min_w_0()495 .min_w_0()
512 .flex()496 .flex()
513 .flex_col()497 .flex_col()
514- .gap(px(2.))498+ .gap(px(space::XXS))
515 .child(499 .child(
516 div()500 div()
517- .text_size(text(16.))501+ .text_size(text(text::BODY))
518 .font_weight(FontWeight::SEMIBOLD)502 .font_weight(FontWeight::SEMIBOLD)
519 .truncate()503 .truncate()
520 .child(title),504 .child(title),
@@ -522,7 +506,7 @@ pub(super) fn picture_card(picture: Picture, entity: &Entity<Yumush>, palette: P
522 .when(!subtitle.is_empty(), |this| {506 .when(!subtitle.is_empty(), |this| {
523 this.child(507 this.child(
524 div()508 div()
525- .text_size(text(12.))509+ .text_size(text(text::CAPTION))
526 .text_color(palette.muted)510 .text_color(palette.muted)
527 .truncate()511 .truncate()
528 .child(subtitle),512 .child(subtitle),
@@ -549,12 +533,12 @@ pub(super) fn small_button(
549 on_click: impl Fn(&mut Window, &mut App) + 'static,533 on_click: impl Fn(&mut Window, &mut App) + 'static,
550 ) -> Stateful<Div> {534 ) -> Stateful<Div> {
551 clickable(id, palette, on_click)535 clickable(id, palette, on_click)
552- .h(px(28.))536+ .h(px(size::CONTROL_SM))
553- .px(px(10.))537+ .px(px(space::MD))
554 .flex()538 .flex()
555 .items_center()539 .items_center()
556- .rounded(px(6.))540+ .rounded(px(radius::MD))
557- .text_size(text(13.))541+ .text_size(text(text::LABEL))
558 .text_color(color)542 .text_color(color)
559 }543 }
560 544
@@ -572,7 +556,7 @@ pub(super) fn delete_control(
572 entity.update(cx, |yumush, cx| action(yumush, window, cx));556 entity.update(cx, |yumush, cx| action(yumush, window, cx));
573 })557 })
574 .border_1()558 .border_1()
575- .border_color(palette.danger.opacity(0.5))559+ .border_color(palette.border)
576 .when(confirming, |this| {560 .when(confirming, |this| {
577 this.bg(palette.danger).text_color(palette.on_accent)561 this.bg(palette.danger).text_color(palette.on_accent)
578 })562 })
@@ -581,9 +565,9 @@ pub(super) fn delete_control(
581 565
582 pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {566 pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {
583 div()567 div()
584- .min_h(px(48.))568+ .min_h(px(size::ROW))
585- .py(px(10.))569+ .py(px(space::MD))
586- .px(px(12.))570+ .px(px(space::MD))
587 .flex()571 .flex()
588 .items_center()572 .items_center()
589 .justify_between()573 .justify_between()
@@ -593,11 +577,11 @@ pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {
593 577
594 pub(super) fn segment_track(palette: Palette) -> Div {578 pub(super) fn segment_track(palette: Palette) -> Div {
595 div()579 div()
596- .h(px(30.))580+ .h(px(size::CONTROL))
597- .p(px(3.))581+ .p(px(space::XXS))
598 .flex()582 .flex()
599- .gap(px(2.))583+ .gap(px(space::XXS))
600- .rounded(px(8.))584+ .rounded(px(radius::MD))
601 .border_1()585 .border_1()
602 .border_color(palette.border)586 .border_color(palette.border)
603 .bg(palette.window)587 .bg(palette.window)
@@ -613,7 +597,7 @@ pub(super) fn segment<E: Styled>(item: E, active: bool, palette: Palette) -> E {
613 item.flex()597 item.flex()
614 .items_center()598 .items_center()
615 .justify_center()599 .justify_center()
616- .rounded(px(5.))600+ .rounded(px(radius::SM))
617 .border_1()601 .border_1()
618 .border_color(border)602 .border_color(border)
619 .bg(background)603 .bg(background)
@@ -627,17 +611,30 @@ pub(super) fn segmented<T: Copy + PartialEq + 'static>(
627 palette: Palette,611 palette: Palette,
628 select: fn(&mut Yumush, T, &mut Context<Yumush>),612 select: fn(&mut Yumush, T, &mut Context<Yumush>),
629 ) -> impl IntoElement {613 ) -> impl IntoElement {
630- segment_track(palette).children(options.into_iter().map(|(choice, label)| {614+ div()
631- let entity = entity.clone();615+ .flex()
632-616+ .gap(px(space::LG))
633- segment(617+ .children(options.into_iter().map(|(choice, label)| {
634- clickable(label, palette, move |_, cx| {618+ let entity = entity.clone();
635- entity.update(cx, |yumush, cx| select(yumush, choice, cx));619+ let on = choice == selected;
636- }),620+
637- choice == selected,621+ div()
638- palette,622+ .id(label)
639- )623+ .cursor_pointer()
640- .px(px(10.))624+ .flex()
641- .child(label)625+ .flex_col()
642- }))626+ .gap(px(space::XXS))
627+ .text_size(text(text::UI))
628+ .font_weight(FontWeight::MEDIUM)
629+ .text_color(if on { palette.tokens.paper() } else { palette.muted })
630+ .on_click(move |_, _, cx| {
631+ entity.update(cx, |yumush, cx| select(yumush, choice, cx));
632+ })
633+ .child(label)
634+ .child(div().h(px(stroke::LINE)).bg(if on {
635+ palette.tokens.paper()
636+ } else {
637+ transparent_black()
638+ }))
639+ }))
643 }640 }
crates/client/src/gui/share_view.rsmodified+51 -53
@@ -7,6 +7,8 @@ use std::{
7 use common::share::{Codec, Fps, Kind, Mode, Quality, Resolution, clamp, options};7 use common::share::{Codec, Fps, Kind, Mode, Quality, Resolution, clamp, options};
8 8
9 const FULL_VOLUME: f32 = 100.;9 const FULL_VOLUME: f32 = 100.;
10+const VOLUME_WIDTH: f32 = 80.;
11+const APPS_HEIGHT: f32 = 160.;
10 12
11 const TOP_QUALITY: Quality = Quality {13 const TOP_QUALITY: Quality = Quality {
12 resolution: Resolution::P2160,14 resolution: Resolution::P2160,
@@ -36,6 +38,7 @@ use super::{
36 notify_error, pop_in,38 notify_error, pop_in,
37 settings_page::segmented,39 settings_page::segmented,
38 stream_stats::{stream_card, watch_stats},40 stream_stats::{stream_card, watch_stats},
41+ style::{radius, size, space, text},
39 surface::Surface,42 surface::Surface,
40 text,43 text,
41 widget::{icon_button, spawn_warn},44 widget::{icon_button, spawn_warn},
@@ -576,7 +579,7 @@ impl Yumush {
576 .min_h_0()579 .min_h_0()
577 .relative()580 .relative()
578 .occlude()581 .occlude()
579- .bg(gpui_kit::black())582+ .bg(palette.window)
580 .on_mouse_move({583 .on_mouse_move({
581 let entity = entity.clone();584 let entity = entity.clone();
582 move |_, _, cx| {585 move |_, _, cx| {
@@ -606,9 +609,9 @@ impl Yumush {
606 .child(609 .child(
607 camera_view::tile_label(self, palette, (viewer.user_id, viewer.kind))610 camera_view::tile_label(self, palette, (viewer.user_id, viewer.kind))
608 .absolute()611 .absolute()
609- .left(px(10.))612+ .left(px(space::MD))
610- .top(px(10.))613+ .top(px(space::MD))
611- .when(!bar, |this| this.opacity(0.)),614+ .when(!bar, |this| this.invisible()),
612 )615 )
613 .children(stats.map(|_| {616 .children(stats.map(|_| {
614 let entity = entity.clone();617 let entity = entity.clone();
@@ -616,21 +619,21 @@ impl Yumush {
616 div()619 div()
617 .occlude()620 .occlude()
618 .absolute()621 .absolute()
619- .right(px(10.))622+ .right(px(space::MD))
620- .top(px(10.))623+ .top(px(space::MD))
621- .when(!bar && !viewer.stats, |this| this.opacity(0.))624+ .when(!bar && !viewer.stats, |this| this.invisible())
622 .flex()625 .flex()
623 .items_center()626 .items_center()
624- .gap(px(6.))627+ .gap(px(space::SM))
625 .child(628 .child(
626 div()629 div()
627- .h(px(22.))630+ .h(px(size::CHIP))
628- .px(px(8.))631+ .px(px(space::SM))
629 .flex()632 .flex()
630 .items_center()633 .items_center()
631- .rounded(px(11.))634+ .rounded(px(radius::MD))
632- .bg(gpui_kit::black().opacity(0.72))635+ .bg(palette.field)
633- .text_size(text(11.))636+ .text_size(text(text::CAPTION))
634 .text_color(tone)637 .text_color(tone)
635 .child(format!("{}p{}", top.resolution.height(), top.fps.value())),638 .child(format!("{}p{}", top.resolution.height(), top.fps.value())),
636 )639 )
@@ -638,14 +641,14 @@ impl Yumush {
638 div()641 div()
639 .id("viewer_stats_button")642 .id("viewer_stats_button")
640 .tip("Stream stats")643 .tip("Stream stats")
641- .size(px(26.))644+ .size(px(size::CONTROL_SM))
642 .flex()645 .flex()
643 .flex_shrink_0()646 .flex_shrink_0()
644 .items_center()647 .items_center()
645 .justify_center()648 .justify_center()
646- .rounded(px(6.))649+ .rounded(px(radius::MD))
647 .cursor_pointer()650 .cursor_pointer()
648- .bg(gpui_kit::black().opacity(0.72))651+ .bg(palette.field)
649 .text_color(if viewer.stats { tone } else { palette.muted })652 .text_color(if viewer.stats { tone } else { palette.muted })
650 .hover(|style| style.bg(palette.hover).text_color(palette.text))653 .hover(|style| style.bg(palette.hover).text_color(palette.text))
651 .on_click(move |_, _, cx| {654 .on_click(move |_, _, cx| {
@@ -656,7 +659,7 @@ impl Yumush {
656 cx.notify();659 cx.notify();
657 })660 })
658 })661 })
659- .child(Icon::new(IconName::ChartBar).w(px(14.)).h(px(14.))),662+ .child(Icon::new(IconName::ChartBar).size(px(size::ICON_SM))),
660 )663 )
661 }))664 }))
662 .when(viewer.stats, |this| {665 .when(viewer.stats, |this| {
@@ -664,8 +667,8 @@ impl Yumush {
664 div()667 div()
665 .occlude()668 .occlude()
666 .absolute()669 .absolute()
667- .right(px(10.))670+ .right(px(space::MD))
668- .top(px(42.))671+ .top(px(space::XXL))
669 .child(stream_card(self, user_id, kind, palette)),672 .child(stream_card(self, user_id, kind, palette)),
670 )673 )
671 })674 })
@@ -674,22 +677,20 @@ impl Yumush {
674 .absolute()677 .absolute()
675 .left_0()678 .left_0()
676 .right_0()679 .right_0()
677- .bottom(px(12.))680+ .bottom(px(space::MD))
678 .flex()681 .flex()
679 .justify_center()682 .justify_center()
680 .on_mouse_up(MouseButton::Left, |_, _, cx| cx.stop_propagation())683 .on_mouse_up(MouseButton::Left, |_, _, cx| cx.stop_propagation())
681- .when(!bar, |this| this.opacity(0.))684+ .when(!bar, |this| this.invisible())
682 .child(685 .child(
683 div()686 div()
684- .h(px(38.))687+ .h(px(size::CONTROL))
685- .px(px(4.))688+ .px(px(space::XS))
686 .flex()689 .flex()
687 .items_center()690 .items_center()
688- .gap(px(4.))691+ .gap(px(space::XS))
689- .rounded(px(10.))692+ .rounded(px(radius::LG))
690- .bg(gpui_kit::black().opacity(0.85))693+ .bg(palette.field)
691- .border_1()
692- .border_color(palette.border)
693 .children(audio.then(|| {694 .children(audio.then(|| {
694 let muted = self.settings.share.volume == 0.;695 let muted = self.settings.share.volume == 0.;
695 icon_button(696 icon_button(
@@ -707,7 +708,7 @@ impl Yumush {
707 )708 )
708 }))709 }))
709 .children(audio.then(|| {710 .children(audio.then(|| {
710- div().w(px(80.)).child(711+ div().w(px(VOLUME_WIDTH)).child(
711 Slider::new(&viewer.volume)712 Slider::new(&viewer.volume)
712 .bg(palette.screen)713 .bg(palette.screen)
713 .text_color(palette.text),714 .text_color(palette.text),
@@ -749,16 +750,14 @@ fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) ->
749 let screen = kind == Kind::Screen;750 let screen = kind == Kind::Screen;
750 751
751 div()752 div()
752- .w(px(320.))753+ .w(px(size::POPOVER))
753- .p(px(10.))754+ .p(px(space::MD))
754 .flex()755 .flex()
755 .flex_col()756 .flex_col()
756- .gap(px(12.))757+ .gap(px(space::MD))
757- .text_size(text(12.))758+ .text_size(text(text::CAPTION))
758- .rounded(px(8.))759+ .rounded(px(radius::LG))
759- .border_1()760+ .bg(palette.field)
760- .border_color(palette.border)
761- .bg(palette.panel)
762 .child(field(761 .child(field(
763 "Resolution",762 "Resolution",
764 segmented(763 segmented(
@@ -836,7 +835,7 @@ fn audio_list(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Opt
836 .filter(|app| app.kind == AudioKind::App)835 .filter(|app| app.kind == AudioKind::App)
837 .collect();836 .collect();
838 (!apps.is_empty()).then(|| {837 (!apps.is_empty()).then(|| {
839- let rows = div().flex().flex_col().gap(px(2.)).children(838+ let rows = div().flex().flex_col().gap(px(space::XXS)).children(
840 apps.into_iter()839 apps.into_iter()
841 .map(|app| include_row(entity, settings, app, palette)),840 .map(|app| include_row(entity, settings, app, palette)),
842 );841 );
@@ -852,7 +851,7 @@ fn audio_list(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Opt
852 fn app_list(rows: impl IntoElement) -> impl IntoElement {851 fn app_list(rows: impl IntoElement) -> impl IntoElement {
853 div()852 div()
854 .id("share_apps")853 .id("share_apps")
855- .max_h(px(160.))854+ .max_h(px(APPS_HEIGHT))
856 .overflow_y_scroll()855 .overflow_y_scroll()
857 .child(rows)856 .child(rows)
858 }857 }
@@ -872,7 +871,7 @@ fn pick_list(
872 div()871 div()
873 .flex()872 .flex()
874 .flex_col()873 .flex_col()
875- .gap(px(8.))874+ .gap(px(space::SM))
876 .children(groups.into_iter().filter_map(|(kind, label)| {875 .children(groups.into_iter().filter_map(|(kind, label)| {
877 let rows: Vec<_> = apps876 let rows: Vec<_> = apps
878 .iter()877 .iter()
@@ -887,11 +886,11 @@ fn group(label: &'static str, rows: Vec<impl IntoElement>, palette: Palette) ->
887 div()886 div()
888 .flex()887 .flex()
889 .flex_col()888 .flex_col()
890- .gap(px(2.))889+ .gap(px(space::XXS))
891 .child(890 .child(
892 div()891 div()
893- .px(px(8.))892+ .px(px(space::SM))
894- .text_size(text(11.))893+ .text_size(text(text::CAPTION))
895 .text_color(palette.muted)894 .text_color(palette.muted)
896 .child(label),895 .child(label),
897 )896 )
@@ -902,10 +901,10 @@ fn field(label: &'static str, control: impl IntoElement, palette: Palette) -> Di
902 div()901 div()
903 .flex()902 .flex()
904 .flex_col()903 .flex_col()
905- .gap(px(6.))904+ .gap(px(space::SM))
906 .child(905 .child(
907 div()906 div()
908- .text_size(text(11.))907+ .text_size(text(text::CAPTION))
909 .text_color(palette.muted)908 .text_color(palette.muted)
910 .child(label),909 .child(label),
911 )910 )
@@ -913,12 +912,12 @@ fn field(label: &'static str, control: impl IntoElement, palette: Palette) -> Di
913 }912 }
914 913
915 fn row_style<E: Styled>(item: E) -> E {914 fn row_style<E: Styled>(item: E) -> E {
916- item.h(px(28.))915+ item.h(px(size::CONTROL_SM))
917- .px(px(8.))916+ .px(px(space::SM))
918 .flex()917 .flex()
919 .items_center()918 .items_center()
920- .gap(px(8.))919+ .gap(px(space::SM))
921- .rounded(px(6.))920+ .rounded(px(radius::MD))
922 }921 }
923 922
924 fn name_cell(app: &AudioApp, palette: Palette) -> Div {923 fn name_cell(app: &AudioApp, palette: Palette) -> Div {
@@ -927,13 +926,13 @@ fn name_cell(app: &AudioApp, palette: Palette) -> Div {
927 .min_w_0()926 .min_w_0()
928 .flex()927 .flex()
929 .items_baseline()928 .items_baseline()
930- .gap(px(6.))929+ .gap(px(space::SM))
931 .child(div().flex_none().child(app.name.clone()))930 .child(div().flex_none().child(app.name.clone()))
932 .child(931 .child(
933 div()932 div()
934 .min_w_0()933 .min_w_0()
935 .truncate()934 .truncate()
936- .text_size(text(11.))935+ .text_size(text(text::CAPTION))
937 .text_color(palette.muted)936 .text_color(palette.muted)
938 .child(app.detail.clone()),937 .child(app.detail.clone()),
939 )938 )
@@ -982,8 +981,7 @@ fn pick_row(
982 .child(name_cell(app, palette))981 .child(name_cell(app, palette))
983 .children(chosen.then(|| {982 .children(chosen.then(|| {
984 Icon::new(IconName::Check)983 Icon::new(IconName::Check)
985- .w(px(14.))984+ .size(px(size::ICON_SM))
986- .h(px(14.))
987 .flex_shrink_0()985 .flex_shrink_0()
988 .text_color(palette.ok)986 .text_color(palette.ok)
989 }))987 }))
crates/client/src/gui/sidebar.rsmodified+161 -145
@@ -10,7 +10,7 @@ use common::{
10 };10 };
11 use gpui_kit::{11 use gpui_kit::{
12 Anchor, AnimationExt, AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement,12 Anchor, AnimationExt, AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement,
13- IntoElement, ParentElement, Pixels, StatefulInteractiveElement, Styled, Window,13+ IntoElement, ParentElement, StatefulInteractiveElement, Styled, Window,
14 assets::IconName,14 assets::IconName,
15 component::{15 component::{
16 Icon,16 Icon,
@@ -25,18 +25,15 @@ use gpui_kit::{
25 use super::{25 use super::{
26 Palette, Tooltip as _, Yumush, avatar,26 Palette, Tooltip as _, Yumush, avatar,
27 chat::{View, create_community},27 chat::{View, create_community},
28- clickable, community_icon, community_name, entity_action, hoverable, hoverable_with,28+ clickable, community_icon, community_name, entity_action, hoverable, input_dialog, motion,
29- input_dialog, motion, presence_avatar,29+ presence_avatar,
30 profile::profile_popover,30 profile::profile_popover,
31- settings_page::{segment, segment_track},
32 social::Relation,31 social::Relation,
32+ style::{radius, size, space, stroke, text},
33 wave::mini_wave,33 wave::mini_wave,
34 widget::{bare_input, compact_frame, icon_button},34 widget::{bare_input, compact_frame, icon_button},
35 };35 };
36 36
37-const SIDEBAR_WIDTH: f32 = 232.;
38-const SIDEBAR_COLLAPSED_WIDTH: f32 = 48.;
39-
40 #[derive(Debug, Clone, Copy, PartialEq, Eq)]37 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
41 pub enum SidebarTab {38 pub enum SidebarTab {
42 Messages,39 Messages,
@@ -52,9 +49,9 @@ impl Yumush {
52 ) -> impl IntoElement {49 ) -> impl IntoElement {
53 let collapsed = self.chat.sidebar_collapsed;50 let collapsed = self.chat.sidebar_collapsed;
54 let (from, to, id) = if collapsed {51 let (from, to, id) = if collapsed {
55- (SIDEBAR_WIDTH, SIDEBAR_COLLAPSED_WIDTH, "sidebar_collapsing")52+ (size::SIDEBAR, size::ROW, "sidebar_collapsing")
56 } else {53 } else {
57- (SIDEBAR_COLLAPSED_WIDTH, SIDEBAR_WIDTH, "sidebar_expanding")54+ (size::ROW, size::SIDEBAR, "sidebar_expanding")
58 };55 };
59 let content = if collapsed {56 let content = if collapsed {
60 self.collapsed_sidebar(entity, palette).into_any_element()57 self.collapsed_sidebar(entity, palette).into_any_element()
@@ -75,19 +72,19 @@ impl Yumush {
75 fn collapsed_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> Div {72 fn collapsed_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> Div {
76 div()73 div()
77 .h_full()74 .h_full()
78- .w(px(SIDEBAR_COLLAPSED_WIDTH))75+ .w(px(size::ROW))
79 .flex()76 .flex()
80 .flex_col()77 .flex_col()
81 .items_center()78 .items_center()
82 .justify_between()79 .justify_between()
83- .py(px(12.))80+ .py(px(space::MD))
84 .child(self.collapse_button(entity, palette))81 .child(self.collapse_button(entity, palette))
85 .child(82 .child(
86 div()83 div()
87 .flex()84 .flex()
88 .flex_col()85 .flex_col()
89 .items_center()86 .items_center()
90- .gap(px(10.))87+ .gap(px(space::MD))
91 .children(self.voice_dot(entity, palette))88 .children(self.voice_dot(entity, palette))
92 .children(89 .children(
93 self.user90 self.user
@@ -112,17 +109,17 @@ impl Yumush {
112 109
113 div()110 div()
114 .h_full()111 .h_full()
115- .w(px(SIDEBAR_WIDTH))112+ .w(px(size::SIDEBAR))
116 .flex()113 .flex()
117 .flex_col()114 .flex_col()
118- .py(px(12.))115+ .py(px(space::MD))
119- .px(px(10.))116+ .px(px(space::MD))
120- .gap(px(14.))117+ .gap(px(space::LG))
121 .child(118 .child(
122 div()119 div()
123 .flex()120 .flex()
124 .items_center()121 .items_center()
125- .gap(px(6.))122+ .gap(px(space::SM))
126 .child(self.tab_bar(entity, palette))123 .child(self.tab_bar(entity, palette))
127 .child(self.collapse_button(entity, palette)),124 .child(self.collapse_button(entity, palette)),
128 )125 )
@@ -145,21 +142,27 @@ impl Yumush {
145 .iter()142 .iter()
146 .filter(|id| self.chat.waves.speaking.contains(id))143 .filter(|id| self.chat.waves.speaking.contains(id))
147 .find_map(|id| self.chat.waves.voice(*id));144 .find_map(|id| self.chat.waves.voice(*id));
145+ let voice = if wave.is_some() {
146+ super::parts::Voice::Live(palette.ok)
147+ } else {
148+ super::parts::Voice::Quiet
149+ };
148 div()150 div()
149 .id(format!("voice_chip_{community_id}"))151 .id(format!("voice_chip_{community_id}"))
150 .tip("In call")152 .tip("In call")
151- .h(px(18.))
152- .px(px(5.))
153 .flex()153 .flex()
154 .items_center()154 .items_center()
155- .gap(px(4.))155+ .gap(px(space::XS))
156- .rounded(px(4.))
157- .bg(palette.ok.opacity(0.15))
158- .children(wave.map(|history| mini_wave(history, 12., palette.ok)))
159 .child(156 .child(
160 div()157 div()
161- .text_size(text(11.))158+ .w(px(size::CONTROL))
162- .text_color(palette.ok)159+ .h(px(space::MD))
160+ .child(super::parts::voice_line(wave, voice, palette.tokens)),
161+ )
162+ .child(
163+ div()
164+ .text_size(text(text::CAPTION))
165+ .text_color(palette.muted)
163 .child(ids.len().to_string()),166 .child(ids.len().to_string()),
164 )167 )
165 .into_any_element()168 .into_any_element()
@@ -178,15 +181,15 @@ impl Yumush {
178 181
179 Some(182 Some(
180 div()183 div()
181- .ml(px(18.))184+ .ml(px(space::LG))
182- .pl(px(10.))185+ .pl(px(space::MD))
183 .border_l_1()186 .border_l_1()
184 .border_color(palette.border)187 .border_color(palette.border)
185 .flex()188 .flex()
186 .flex_col()189 .flex_col()
187- .gap(px(1.))190+ .gap(px(space::XXS))
188- .mt(px(2.))191+ .mt(px(space::XXS))
189- .mb(px(4.))192+ .mb(px(space::XS))
190 .children(members),193 .children(members),
191 )194 )
192 }195 }
@@ -205,10 +208,11 @@ impl Yumush {
205 let speaking = self.chat.waves.speaking.contains(&user_id);208 let speaking = self.chat.waves.speaking.contains(&user_id);
206 let shown = speaking || (me && !muted);209 let shown = speaking || (me && !muted);
207 let wave = shown.then(|| self.chat.waves.voice(user_id)).flatten();210 let wave = shown.then(|| self.chat.waves.voice(user_id)).flatten();
208- let wave_tone =211+ let voice = if wave.is_some() {
209- self.chat212+ super::parts::Voice::Live(palette.tinted(user_id))
210- .waves213+ } else {
211- .tone(user_id, self.user.as_ref().map(|user| user.id), palette.ok);214+ super::parts::Voice::Quiet
215+ };
212 let camera = self216 let camera = self
213 .chat217 .chat
214 .share_of(community_id, user_id, Kind::Camera)218 .share_of(community_id, user_id, Kind::Camera)
@@ -222,37 +226,41 @@ impl Yumush {
222 let identity = div()226 let identity = div()
223 .flex()227 .flex()
224 .items_center()228 .items_center()
225- .gap(px(6.))229+ .gap(px(space::SM))
226 .flex_1()230 .flex_1()
227 .min_w_0()231 .min_w_0()
228 .cursor_pointer()232 .cursor_pointer()
229- .child(avatar(palette, user, px(18.), text(9.), &self.chat.avatars))
230 .child(233 .child(
231 div()234 div()
232 .min_w_0()235 .min_w_0()
233 .truncate()236 .truncate()
234- .text_size(text(12.))237+ .text_size(text(text::LABEL))
235- .text_color(if speaking { palette.text } else { palette.body })238+ .text_color(if speaking { palette.text } else { palette.muted })
236 .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD))239 .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD))
237 .child(user.username.clone()),240 .child(user.username.clone()),
238 )241 )
239- .children(wave.map(|history| mini_wave(history, 12., wave_tone)))242+ .child(
243+ div()
244+ .w(px(size::CONTROL))
245+ .h(px(space::MD))
246+ .flex_none()
247+ .child(super::parts::voice_line(wave, voice, palette.tokens)),
248+ )
240 .children((muted && wave.is_none()).then(|| {249 .children((muted && wave.is_none()).then(|| {
241 Icon::new(IconName::MicOff)250 Icon::new(IconName::MicOff)
242- .w(px(12.))251+ .size(px(size::ICON_SM))
243- .h(px(12.))
244 .text_color(palette.danger)252 .text_color(palette.danger)
245 }));253 }));
246 254
247 div()255 div()
248- .h(px(26.))256+ .h(px(size::CONTROL_SM))
249- .px(px(6.))257+ .px(px(space::SM))
250- .rounded(px(6.))258+ .rounded(px(radius::MD))
251 .flex()259 .flex()
252 .items_center()260 .items_center()
253- .gap(px(6.))261+ .gap(px(space::SM))
254 .hover(move |style| style.bg(palette.hover))262 .hover(move |style| style.bg(palette.hover))
255- .when(ghost, |row| row.opacity(0.5))263+ .when(ghost, |row| row.text_color(palette.tokens.faint()))
256 .child(div().flex_1().min_w_0().child(profile_popover(264 .child(div().flex_1().min_w_0().child(profile_popover(
257 format!("call_member_{user_id}"),265 format!("call_member_{user_id}"),
258 Anchor::BottomLeft,266 Anchor::BottomLeft,
@@ -286,24 +294,20 @@ impl Yumush {
286 let community = self.chat.voice_room()?;294 let community = self.chat.voice_room()?;
287 295
288 Some(296 Some(
289- call_style(297+ clickable(
290- clickable(298+ "voice_panel_go_collapsed",
291- "voice_panel_go_collapsed",
292- palette,
293- go_to_call(entity, community),
294- ),
295 palette,299 palette,
300+ go_to_call(entity, community),
296 )301 )
297 .tip("Go to call")302 .tip("Go to call")
298- .size(px(28.))303+ .size(px(size::CONTROL_SM))
299 .flex()304 .flex()
300 .items_center()305 .items_center()
301 .justify_center()306 .justify_center()
302- .rounded(px(6.))307+ .rounded(px(radius::MD))
303 .child(308 .child(
304 Icon::new(IconName::AudioLines)309 Icon::new(IconName::AudioLines)
305- .w(px(14.))310+ .size(px(size::ICON_SM))
306- .h(px(14.))
307 .text_color(palette.ok),311 .text_color(palette.ok),
308 ),312 ),
309 )313 )
@@ -372,25 +376,35 @@ impl Yumush {
372 ),376 ),
373 ];377 ];
374 378
375- segment_track(palette)379+ div()
376 .flex_1()380 .flex_1()
381+ .flex()
382+ .items_center()
383+ .gap(px(space::LG))
377 .children(tabs.map(|(tab, label, alert)| {384 .children(tabs.map(|(tab, label, alert)| {
378- let item = segment(385+ let active = self.chat.tab == tab;
379- clickable(386+ let item = clickable(
380- label,387+ label,
381- palette,
382- entity_action(entity, move |yumush, window, cx| {
383- yumush.set_sidebar_tab(tab, window, cx)
384- }),
385- ),
386- self.chat.tab == tab,
387 palette,388 palette,
389+ entity_action(entity, move |yumush, window, cx| {
390+ yumush.set_sidebar_tab(tab, window, cx)
391+ }),
388 )392 )
389- .flex_1()393+ .flex()
390- .gap(px(6.))394+ .flex_col()
391- .text_size(text(12.))395+ .gap(px(space::XXS))
392- .child(label)396+ .text_size(text(text::CAPTION))
393- .children(unread_badge(palette, false, Some(&alert)));397+ .text_color(if active { palette.text } else { palette.muted })
398+ .when(active, |item| item.font_weight(FontWeight::MEDIUM))
399+ .child(
400+ div()
401+ .flex()
402+ .items_center()
403+ .gap(px(space::XS))
404+ .child(label)
405+ .children(unread_badge(palette, false, Some(&alert))),
406+ )
407+ .children(active.then(|| div().h(px(stroke::LINE)).bg(palette.text)));
394 408
395 match tab {409 match tab {
396 SidebarTab::Communities => item410 SidebarTab::Communities => item
@@ -411,7 +425,7 @@ impl Yumush {
411 div()425 div()
412 .flex()426 .flex()
413 .flex_col()427 .flex_col()
414- .gap(px(14.))428+ .gap(px(space::LG))
415 .child(self.notes_row(entity, palette))429 .child(self.notes_row(entity, palette))
416 .children(found.map(|user| self.found_row(entity, user, palette)))430 .children(found.map(|user| self.found_row(entity, user, palette)))
417 .children(431 .children(
@@ -424,7 +438,7 @@ impl Yumush {
424 div()438 div()
425 .flex()439 .flex()
426 .flex_col()440 .flex_col()
427- .gap(px(1.))441+ .gap(px(space::XXS))
428 .children(self.direct_rows(entity, query, palette)),442 .children(self.direct_rows(entity, query, palette)),
429 )443 )
430 .children(group(444 .children(group(
@@ -440,19 +454,18 @@ impl Yumush {
440 let unread = notes.and_then(|notes| self.chat.unread.get(&notes.id));454 let unread = notes.and_then(|notes| self.chat.unread.get(&notes.id));
441 let open = entity.clone();455 let open = entity.clone();
442 456
443- hoverable_with(457+ hoverable(
444 "notes",458 "notes",
445 entry(459 entry(
446 palette,460 palette,
447 active,461 active,
448 Icon::new(IconName::Bookmark)462 Icon::new(IconName::Bookmark)
449- .w(px(20.))463+ .size(px(size::ICON))
450- .h(px(20.))
451 .text_color(palette.accent),464 .text_color(palette.accent),
452 "Notes",465 "Notes",
453 unread_badge(palette, false, unread),466 unread_badge(palette, false, unread),
454 ),467 ),
455- palette.accent.opacity(0.1),468+ palette,
456 )469 )
457 .on_click(move |_, window, cx| open.update(cx, |yumush, cx| yumush.open_notes(window, cx)))470 .on_click(move |_, window, cx| open.update(cx, |yumush, cx| yumush.open_notes(window, cx)))
458 .into_any_element()471 .into_any_element()
@@ -474,7 +487,7 @@ impl Yumush {
474 }487 }
475 488
476 fn communities_list(&self, entity: &Entity<Self>, palette: Palette) -> Div {489 fn communities_list(&self, entity: &Entity<Self>, palette: Palette) -> Div {
477- div().flex().flex_col().gap(px(1.)).children(490+ div().flex().flex_col().gap(px(space::XXS)).children(
478 self.chat491 self.chat
479 .communities492 .communities
480 .iter()493 .iter()
@@ -489,7 +502,6 @@ impl Yumush {
489 entity,502 entity,
490 community,503 community,
491 palette,504 palette,
492- px(16.),
493 "community",505 "community",
494 community_menu(entity, community.id, can_leave, muted),506 community_menu(entity, community.id, can_leave, muted),
495 );507 );
@@ -508,7 +520,6 @@ impl Yumush {
508 entity: &Entity<Self>,520 entity: &Entity<Self>,
509 community: &Community,521 community: &Community,
510 palette: Palette,522 palette: Palette,
511- size: Pixels,
512 key: &str,523 key: &str,
513 menu: impl Fn(PopupMenu, &mut Window, &mut Context<PopupMenu>) -> PopupMenu + 'static,524 menu: impl Fn(PopupMenu, &mut Window, &mut Context<PopupMenu>) -> PopupMenu + 'static,
514 ) -> AnyElement {525 ) -> AnyElement {
@@ -523,17 +534,25 @@ impl Yumush {
523 } else {534 } else {
524 Some(self.voice_chip(community_id, palette))535 Some(self.voice_chip(community_id, palette))
525 };536 };
526- let themed = palette;537+ hoverable(
527- hoverable_with(
528 format!("{key}_{}", community.id),538 format!("{key}_{}", community.id),
529- entry(539+ div()
530- themed,540+ .h(px(size::CONTROL))
531- active,541+ .px(px(space::SM))
532- self.community_badge(community, size, text(10.), palette),542+ .rounded(px(radius::MD))
533- community_name(community).to_string(),543+ .flex()
534- trailing,544+ .items_center()
535- ),545+ .gap(px(space::XS))
536- themed.accent.opacity(0.1),546+ .text_color(if active { palette.text } else { palette.muted })
547+ .when(active, |row| row.font_weight(FontWeight::MEDIUM))
548+ .child(
549+ div()
550+ .min_w_0()
551+ .truncate()
552+ .child(community_name(community).to_string()),
553+ )
554+ .children(trailing),
555+ palette,
537 )556 )
538 .on_click(move |_, window, cx| {557 .on_click(move |_, window, cx| {
539 select.update(cx, |yumush, cx| {558 select.update(cx, |yumush, cx| {
@@ -582,7 +601,6 @@ impl Yumush {
582 entity,601 entity,
583 community,602 community,
584 palette,603 palette,
585- px(20.),
586 "direct",604 "direct",
587 move |menu, _, _| mute_item(menu, &menu_entity, menu_id, muted),605 move |menu, _, _| mute_item(menu, &menu_entity, menu_id, muted),
588 )606 )
@@ -668,9 +686,9 @@ impl Yumush {
668 palette,686 palette,
669 false,687 false,
670 presence_avatar(688 presence_avatar(
671- avatar(palette, user, px(20.), text(10.), &self.chat.avatars),689+ avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),
672 self.presence_of(user.id),690 self.presence_of(user.id),
673- px(20.),691+ px(size::AVATAR),
674 palette,692 palette,
675 ),693 ),
676 user.username.clone(),694 user.username.clone(),
@@ -732,7 +750,7 @@ impl Yumush {
732 let community = &invitation.community;750 let community = &invitation.community;
733 let label = div().flex().flex_col().child(community.name.clone()).child(751 let label = div().flex().flex_col().child(community.name.clone()).child(
734 div()752 div()
735- .text_size(text(11.))753+ .text_size(text(text::CAPTION))
736 .text_color(palette.muted)754 .text_color(palette.muted)
737 .child(format!("from {}", invitation.inviter.username)),755 .child(format!("from {}", invitation.inviter.username)),
738 );756 );
@@ -740,7 +758,13 @@ impl Yumush {
740 entry(758 entry(
741 palette,759 palette,
742 false,760 false,
743- community_icon(palette, community, px(16.), text(10.), &self.chat.avatars),761+ community_icon(
762+ palette,
763+ community,
764+ px(size::ICON),
765+ text(text::CAPTION),
766+ &self.chat.avatars,
767+ ),
744 label,768 label,
745 [769 [
746 row_button(770 row_button(
@@ -770,10 +794,10 @@ impl Yumush {
770 let user = self.user.as_ref()?;794 let user = self.user.as_ref()?;
771 Some(795 Some(
772 div()796 div()
773- .h(px(36.))797+ .h(px(size::CONTROL))
774 .flex()798 .flex()
775 .items_center()799 .items_center()
776- .gap(px(4.))800+ .gap(px(space::XS))
777 .child(self.account_trigger(entity, user, true, palette))801 .child(self.account_trigger(entity, user, true, palette))
778 .children(self.is_builder().then(|| {802 .children(self.is_builder().then(|| {
779 icon_button(803 icon_button(
@@ -806,14 +830,14 @@ impl Yumush {
806 div()830 div()
807 .flex()831 .flex()
808 .items_center()832 .items_center()
809- .h(px(36.))833+ .h(px(size::CONTROL))
810- .gap(px(8.))834+ .gap(px(space::SM))
811- .px(px(6.))835+ .px(px(space::SM))
812- .rounded(px(6.))836+ .rounded(px(radius::MD))
813 .child(presence_avatar(837 .child(presence_avatar(
814- avatar(palette, user, px(24.), text(12.), &self.chat.avatars),838+ avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),
815 self.presence_of(user.id),839 self.presence_of(user.id),
816- px(24.),840+ px(size::AVATAR),
817 palette,841 palette,
818 ))842 ))
819 .when(named, |trigger| {843 .when(named, |trigger| {
@@ -872,9 +896,9 @@ fn watch_pill(
872 wave: Option<&VecDeque<f32>>,896 wave: Option<&VecDeque<f32>>,
873 palette: Palette,897 palette: Palette,
874 ) -> impl IntoElement {898 ) -> impl IntoElement {
875- let (color, icon) = match kind {899+ let icon = match kind {
876- Kind::Camera => (palette.camera, IconName::Video),900+ Kind::Camera => IconName::Video,
877- Kind::Screen => (palette.screen, IconName::ScreenShare),901+ Kind::Screen => IconName::ScreenShare,
878 };902 };
879 let tip = match (watching, kind) {903 let tip = match (watching, kind) {
880 (true, _) => "Stop watching",904 (true, _) => "Stop watching",
@@ -889,24 +913,20 @@ fn watch_pill(
889 }),913 }),
890 )914 )
891 .tip(tip)915 .tip(tip)
892- .h(px(18.))916+ .h(px(size::CHIP))
893- .px(px(5.))917+ .px(px(space::XS))
894 .flex()918 .flex()
895 .items_center()919 .items_center()
896- .gap(px(4.))920+ .gap(px(space::XS))
897- .rounded(px(5.))921+ .rounded(px(radius::SM))
898- .bg(color.opacity(0.12))922+ .child(
899- .child(Icon::new(icon).w(px(12.)).h(px(12.)).text_color(color))923+ Icon::new(icon)
924+ .size(px(size::ICON_SM))
925+ .text_color(if watching { palette.text } else { palette.muted }),
926+ )
900 .children(wave.map(|history| mini_wave(history, 10., palette.screen)))927 .children(wave.map(|history| mini_wave(history, 10., palette.screen)))
901 }928 }
902 929
903-fn call_style<E: Styled>(element: E, palette: Palette) -> E {
904- element
905- .border_1()
906- .border_color(palette.ok.opacity(0.35))
907- .bg(palette.ok.opacity(0.08))
908-}
909-
910 pub(super) fn unread_badge(930 pub(super) fn unread_badge(
911 palette: Palette,931 palette: Palette,
912 muted: bool,932 muted: bool,
@@ -916,32 +936,28 @@ pub(super) fn unread_badge(
916 return Some(936 return Some(
917 div()937 div()
918 .text_color(palette.muted)938 .text_color(palette.muted)
919- .child(Icon::new(IconName::BellOff).w(px(12.)).h(px(12.)))939+ .child(Icon::new(IconName::BellOff).size(px(size::ICON_SM)))
920 .into_any_element(),940 .into_any_element(),
921 );941 );
922 }942 }
923 let unread = unread.filter(|unread| unread.messages > 0)?;943 let unread = unread.filter(|unread| unread.messages > 0)?;
924- let (fill, ink) = if unread.mentions > 0 {944+ if unread.mentions == 0 {
925- (palette.accent, palette.on_accent)945+ return Some(
926- } else {946+ div()
927- (palette.muted, palette.window)947+ .size(px(space::XS + space::XXS))
928- };948+ .rounded_full()
949+ .bg(palette.text)
950+ .into_any_element(),
951+ );
952+ }
929 let count = match unread.messages {953 let count = match unread.messages {
930 1..=99 => unread.messages.to_string(),954 1..=99 => unread.messages.to_string(),
931 _ => "99+".to_string(),955 _ => "99+".to_string(),
932 };956 };
933 Some(957 Some(
934 div()958 div()
935- .h(px(16.))959+ .text_size(text(text::CAPTION))
936- .min_w(px(16.))960+ .text_color(palette.text)
937- .px(px(4.))
938- .flex()
939- .items_center()
940- .justify_center()
941- .rounded_full()
942- .text_size(text(10.))
943- .bg(fill)
944- .text_color(ink)
945 .child(count)961 .child(count)
946 .into_any_element(),962 .into_any_element(),
947 )963 )
@@ -1033,9 +1049,9 @@ fn new_community_menu(
1033 1049
1034 pub(super) fn input_box(input: &Entity<InputState>, palette: Palette) -> Div {1050 pub(super) fn input_box(input: &Entity<InputState>, palette: Palette) -> Div {
1035 compact_frame(palette)1051 compact_frame(palette)
1036- .gap(px(8.))1052+ .gap(px(space::SM))
1037 .text_color(palette.muted)1053 .text_color(palette.muted)
1038- .child(Icon::new(IconName::Search).w(px(14.)).h(px(14.)))1054+ .child(Icon::new(IconName::Search).size(px(size::ICON_SM)))
1039 .child(bare_input(palette, Input::new(input)))1055 .child(bare_input(palette, Input::new(input)))
1040 }1056 }
1041 1057
@@ -1044,11 +1060,11 @@ fn group(title: &'static str, palette: Palette, rows: Vec<AnyElement>) -> Option
1044 div()1060 div()
1045 .flex()1061 .flex()
1046 .flex_col()1062 .flex_col()
1047- .gap(px(1.))1063+ .gap(px(space::XXS))
1048 .child(1064 .child(
1049 div()1065 div()
1050- .px(px(8.))1066+ .px(px(space::SM))
1051- .text_size(text(11.))1067+ .text_size(text(text::CAPTION))
1052 .text_color(palette.muted)1068 .text_color(palette.muted)
1053 .child(title),1069 .child(title),
1054 )1070 )
@@ -1064,14 +1080,14 @@ fn entry(
1064 trailing: impl IntoIterator<Item = AnyElement>,1080 trailing: impl IntoIterator<Item = AnyElement>,
1065 ) -> Div {1081 ) -> Div {
1066 div()1082 div()
1067- .h(px(36.))1083+ .h(px(size::CONTROL))
1068- .px(px(6.))1084+ .px(px(space::SM))
1069 .flex()1085 .flex()
1070 .items_center()1086 .items_center()
1071- .gap(px(8.))1087+ .gap(px(space::SM))
1072- .rounded(px(6.))1088+ .rounded(px(radius::MD))
1073 .text_color(if active { palette.text } else { palette.body })1089 .text_color(if active { palette.text } else { palette.body })
1074- .when(active, |this| this.bg(palette.accent.opacity(0.18)))1090+ .when(active, |this| this.bg(palette.tokens.press()))
1075 .child(leading)1091 .child(leading)
1076 .child(div().flex_1().min_w_0().truncate().child(label))1092 .child(div().flex_1().min_w_0().truncate().child(label))
1077 .children(trailing)1093 .children(trailing)
crates/client/src/gui/snippet.rsmodified+9 -9
@@ -1,4 +1,4 @@
1-use super::text;1+use super::style::{size, space, text};
2 use crate::gui::CLOCK;2 use crate::gui::CLOCK;
3 use common::model::{Message, Role, SnippetMessage, User};3 use common::model::{Message, Role, SnippetMessage, User};
4 use gpui_kit::{4 use gpui_kit::{
@@ -27,11 +27,11 @@ pub fn snippet_card(
27 panel(palette)27 panel(palette)
28 .flex()28 .flex()
29 .flex_col()29 .flex_col()
30- .gap(px(10.))30+ .gap(px(space::MD))
31- .p(px(10.))31+ .p(px(space::MD))
32 .child(32 .child(
33 div()33 div()
34- .text_size(text(12.))34+ .text_size(super::text(text::CAPTION))
35 .text_color(palette.muted)35 .text_color(palette.muted)
36 .child(header),36 .child(header),
37 )37 )
@@ -61,12 +61,12 @@ fn snippet_row(
61 61
62 div()62 div()
63 .flex()63 .flex()
64- .gap(px(8.))64+ .gap(px(space::SM))
65 .child(user_link(65 .child(user_link(
66 format!("snippet_avatar_{}", item.id),66 format!("snippet_avatar_{}", item.id),
67 Some(&user),67 Some(&user),
68 entity,68 entity,
69- avatar(palette, &user, px(20.), text(10.), &chat.avatars),69+ avatar(palette, &user, px(size::AVATAR), super::text(text::CAPTION), &chat.avatars),
70 ))70 ))
71 .child(71 .child(
72 div()72 div()
@@ -74,12 +74,12 @@ fn snippet_row(
74 .min_w_0()74 .min_w_0()
75 .flex()75 .flex()
76 .flex_col()76 .flex_col()
77- .gap(px(4.))77+ .gap(px(space::XS))
78 .child(78 .child(
79 div()79 div()
80 .flex()80 .flex()
81 .items_center()81 .items_center()
82- .gap(px(6.))82+ .gap(px(space::SM))
83 .child(user_link(83 .child(user_link(
84 format!("snippet_name_{}", item.id),84 format!("snippet_name_{}", item.id),
85 Some(&user),85 Some(&user),
@@ -91,7 +91,7 @@ fn snippet_row(
91 ))91 ))
92 .child(92 .child(
93 div()93 div()
94- .text_size(text(11.))94+ .text_size(super::text(text::CAPTION))
95 .text_color(palette.muted)95 .text_color(palette.muted)
96 .child(millis_time(item.created_at, CLOCK)),96 .child(millis_time(item.created_at, CLOCK)),
97 ),97 ),
crates/client/src/gui/social.rsmodified+10 -9
@@ -22,6 +22,7 @@ use gpui_kit::{
22 22
23 use super::{23 use super::{
24 Palette, Yumush, avatar, new_input, notify_error, primary_button, text,24 Palette, Yumush, avatar, new_input, notify_error, primary_button, text,
25+ style::{radius, size, space},
25 widget::{search_text, spawn_done},26 widget::{search_text, spawn_done},
26 };27 };
27 28
@@ -303,7 +304,7 @@ impl Yumush {
303 div()304 div()
304 .flex()305 .flex()
305 .flex_col()306 .flex_col()
306- .gap(px(12.))307+ .gap(px(space::MD))
307 .child(Input::new(&dialog_input))308 .child(Input::new(&dialog_input))
308 .children(result),309 .children(result),
309 )310 )
@@ -399,7 +400,7 @@ fn invite_result(
399 InviteLookup::Idle => None,400 InviteLookup::Idle => None,
400 InviteLookup::Missing => Some(401 InviteLookup::Missing => Some(
401 div()402 div()
402- .text_size(text(13.))403+ .text_size(text(super::style::text::LABEL))
403 .text_color(palette.muted)404 .text_color(palette.muted)
404 .child("No such user")405 .child("No such user")
405 .into_any_element(),406 .into_any_element(),
@@ -408,7 +409,7 @@ fn invite_result(
408 user_row(user, yumush, palette)409 user_row(user, yumush, palette)
409 .child(410 .child(
410 div()411 div()
411- .text_size(text(13.))412+ .text_size(text(super::style::text::LABEL))
412 .text_color(palette.muted)413 .text_color(palette.muted)
413 .child(Rank::Member.label()),414 .child(Rank::Member.label()),
414 )415 )
@@ -425,11 +426,11 @@ fn invite_result(
425 yumush.send_invite(community_id, window, cx)426 yumush.send_invite(community_id, window, cx)
426 })427 })
427 })428 })
428- .h(px(30.))429+ .h(px(size::CONTROL))
429- .px(px(14.))430+ .px(px(space::LG))
430 .flex()431 .flex()
431 .items_center()432 .items_center()
432- .rounded(px(8.))433+ .rounded(px(radius::MD))
433 .child("Invite"),434 .child("Invite"),
434 )435 )
435 .into_any_element(),436 .into_any_element(),
@@ -442,12 +443,12 @@ fn user_row(user: &User, yumush: &Yumush, palette: Palette) -> Div {
442 div()443 div()
443 .flex()444 .flex()
444 .items_center()445 .items_center()
445- .gap(px(10.))446+ .gap(px(space::MD))
446 .child(avatar(447 .child(avatar(
447 palette,448 palette,
448 user,449 user,
449- px(32.),450+ px(size::AVATAR),
450- text(14.),451+ text(super::style::text::UI),
451 &yumush.chat.avatars,452 &yumush.chat.avatars,
452 ))453 ))
453 .child(454 .child(
crates/client/src/gui/stream_stats.rsmodified+23 -24
@@ -1,12 +1,14 @@
1 use common::{model::Id, share::Kind};1 use common::{model::Id, share::Kind};
2 use gpui_kit::{Div, FontWeight, Hsla, ParentElement, Styled, component::Icon, div, px};2 use gpui_kit::{Div, FontWeight, Hsla, ParentElement, Styled, component::Icon, div, px};
3 3
4-use super::{Palette, Yumush, share_view::kind_icon, text, voice_stats::rate};4+use super::{
5+ Palette, Yumush,
6+ share_view::kind_icon,
7+ style::{radius, size, space, text},
8+ voice_stats::rate,
9+};
5 use crate::{media::decode::Engine, share::session::WatchStats};10 use crate::{media::decode::Engine, share::session::WatchStats};
6 11
7-const GRAPH_HEIGHT: f32 = 48.;
8-const AXIS_WIDTH: f32 = 34.;
9-
10 pub(super) fn watch_stats(yumush: &Yumush, user_id: Id, kind: Kind) -> Option<&WatchStats> {12 pub(super) fn watch_stats(yumush: &Yumush, user_id: Id, kind: Kind) -> Option<&WatchStats> {
11 yumush13 yumush
12 .chat14 .chat
@@ -38,25 +40,22 @@ pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Pal
38 let value = |format: fn(&WatchStats) -> String| stats.map_or("…".to_string(), format);40 let value = |format: fn(&WatchStats) -> String| stats.map_or("…".to_string(), format);
39 41
40 div()42 div()
41- .w(px(300.))43+ .w(px(size::POPOVER))
42- .p(px(12.))44+ .p(px(space::MD))
43 .flex()45 .flex()
44 .flex_col()46 .flex_col()
45- .gap(px(12.))47+ .gap(px(space::MD))
46- .text_size(text(12.))48+ .text_size(super::text(text::CAPTION))
47- .rounded(px(10.))49+ .rounded(px(radius::LG))
48- .border_1()50+ .bg(palette.field)
49- .border_color(palette.border)
50- .bg(palette.panel)
51 .child(51 .child(
52 div()52 div()
53 .flex()53 .flex()
54 .items_center()54 .items_center()
55- .gap(px(6.))55+ .gap(px(space::SM))
56 .child(56 .child(
57 Icon::new(kind_icon(kind))57 Icon::new(kind_icon(kind))
58- .w(px(14.))58+ .size(px(size::ICON_SM))
59- .h(px(14.))
60 .flex_none()59 .flex_none()
61 .text_color(tone),60 .text_color(tone),
62 )61 )
@@ -145,16 +144,16 @@ fn graph(losses: &[f32], color: Hsla, palette: Palette) -> Div {
145 144
146 div()145 div()
147 .flex()146 .flex()
148- .gap(px(6.))147+ .gap(px(space::SM))
149- .h(px(GRAPH_HEIGHT))148+ .h(px(size::ROW))
150 .child(149 .child(
151 div()150 div()
152- .w(px(AXIS_WIDTH))151+ .w(px(size::CONTROL))
153 .h_full()152 .h_full()
154 .flex()153 .flex()
155 .flex_col()154 .flex_col()
156 .justify_between()155 .justify_between()
157- .text_size(text(10.))156+ .text_size(super::text(text::CAPTION))
158 .text_color(palette.muted)157 .text_color(palette.muted)
159 .children([top, top / 2., 0.].map(|value| div().child(format!("{value:.1}%")))),158 .children([top, top / 2., 0.].map(|value| div().child(format!("{value:.1}%")))),
160 )159 )
@@ -162,7 +161,7 @@ fn graph(losses: &[f32], color: Hsla, palette: Palette) -> Div {
162 div()161 div()
163 .flex_1()162 .flex_1()
164 .h_full()163 .h_full()
165- .rounded(px(4.))164+ .rounded(px(radius::SM))
166 .bg(palette.window)165 .bg(palette.window)
167 .child(super::wave::line(levels, color)),166 .child(super::wave::line(levels, color)),
168 )167 )
@@ -172,10 +171,10 @@ fn section(title: &'static str, rows: Vec<Div>, palette: Palette) -> Div {
172 div()171 div()
173 .flex()172 .flex()
174 .flex_col()173 .flex_col()
175- .gap(px(4.))174+ .gap(px(space::XS))
176 .child(175 .child(
177 div()176 div()
178- .text_size(text(11.))177+ .text_size(super::text(text::CAPTION))
179 .font_weight(FontWeight::SEMIBOLD)178 .font_weight(FontWeight::SEMIBOLD)
180 .text_color(palette.muted)179 .text_color(palette.muted)
181 .child(title),180 .child(title),
@@ -188,8 +187,8 @@ fn row(key: &'static str, value: String, palette: Palette) -> Div {
188 .flex()187 .flex()
189 .items_center()188 .items_center()
190 .justify_between()189 .justify_between()
191- .gap(px(8.))190+ .gap(px(space::SM))
192- .text_size(text(11.))191+ .text_size(super::text(text::CAPTION))
193 .child(div().text_color(palette.muted).child(key))192 .child(div().text_color(palette.muted).child(key))
194 .child(193 .child(
195 div()194 div()
crates/client/src/gui/style.rsmodified+1 -36
@@ -125,42 +125,7 @@ mod tests {
125 assert_eq!(names, HUE_NAMES);125 assert_eq!(names, HUE_NAMES);
126 }126 }
127 127
128- const UNMIGRATED: [&str; 34] = [128+ const UNMIGRATED: [&str; 0] = [];
129- "gui/auth.rs",
130- "gui/builder.rs",
131- "gui/builder/access.rs",
132- "gui/builder/backups.rs",
133- "gui/builder/communities.rs",
134- "gui/builder/log.rs",
135- "gui/builder/messages.rs",
136- "gui/builder/overview.rs",
137- "gui/builder/reports.rs",
138- "gui/builder/server.rs",
139- "gui/builder/storage.rs",
140- "gui/builder/ui.rs",
141- "gui/builder/users.rs",
142- "gui/builder/voice.rs",
143- "gui/camera_view.rs",
144- "gui/chat.rs",
145- "gui/community_settings.rs",
146- "gui/composer.rs",
147- "gui/forward.rs",
148- "gui/media_view.rs",
149- "gui/message_actions.rs",
150- "gui/poll.rs",
151- "gui/profile.rs",
152- "gui/settings_page.rs",
153- "gui/share_view.rs",
154- "gui/sidebar.rs",
155- "gui/snippet.rs",
156- "gui/social.rs",
157- "gui/stream_stats.rs",
158- "gui/surface.rs",
159- "gui/voice_note.rs",
160- "gui/voice_settings.rs",
161- "gui/voice_stats.rs",
162- "gui/wave.rs",
163- ];
164 const FREE: [&str; 2] = ["gui/style.rs", "gui/parts.rs"];129 const FREE: [&str; 2] = ["gui/style.rs", "gui/parts.rs"];
165 130
166 fn sources(dir: &std::path::Path, out: &mut Vec<std::path::PathBuf>) {131 fn sources(dir: &std::path::Path, out: &mut Vec<std::path::PathBuf>) {
crates/client/src/gui/voice_note.rsmodified+22 -22
@@ -20,7 +20,9 @@ use super::{
20 chat::VoiceState,20 chat::VoiceState,
21 clickable,21 clickable,
22 media_view::{time_text, upload_file},22 media_view::{time_text, upload_file},
23- notify_error, primary_button, text,23+ notify_error, primary_button,
24+ style::{self, radius, size, space},
25+ text,
24 widget::ok_or_notify,26 widget::ok_or_notify,
25 };27 };
26 use crate::{28 use crate::{
@@ -105,7 +107,7 @@ pub fn bars(
105 div()107 div()
106 .w(px(BAR_WIDTH))108 .w(px(BAR_WIDTH))
107 .h(px((BAR_MAX * level).max(BAR_MIN)))109 .h(px((BAR_MAX * level).max(BAR_MIN)))
108- .rounded(px(BAR_WIDTH / 2.))110+ .rounded_full()
109 .bg(color),111 .bg(color),
110 )112 )
111 }))113 }))
@@ -121,39 +123,37 @@ pub fn recording_row(
121 let send = entity.clone();123 let send = entity.clone();
122 124
123 div()125 div()
124- .min_h(px(40.))126+ .min_h(px(size::ROW))
125- .pl(px(4.))127+ .pl(px(space::XS))
126- .pr(px(4.))128+ .pr(px(space::XS))
127- .py(px(4.))129+ .py(px(space::XS))
128 .flex()130 .flex()
129 .items_center()131 .items_center()
130- .gap(px(8.))132+ .gap(px(space::SM))
131- .rounded(px(8.))133+ .rounded(px(radius::MD))
132- .border_1()
133- .border_color(palette.border)
134 .bg(palette.field)134 .bg(palette.field)
135 .child(135 .child(
136 clickable("cancel_voice_note", palette, move |_, cx| {136 clickable("cancel_voice_note", palette, move |_, cx| {
137 cancel.update(cx, |yumush, cx| yumush.cancel_voice_note(cx))137 cancel.update(cx, |yumush, cx| yumush.cancel_voice_note(cx))
138 })138 })
139 .tip("Cancel")139 .tip("Cancel")
140- .size(px(28.))140+ .size(px(size::CONTROL_SM))
141 .flex()141 .flex()
142 .items_center()142 .items_center()
143 .justify_center()143 .justify_center()
144- .rounded(px(6.))144+ .rounded(px(radius::MD))
145 .text_color(palette.muted)145 .text_color(palette.muted)
146- .child(Icon::new(IconName::X).w(px(16.)).h(px(16.))),146+ .child(Icon::new(IconName::X).size(px(size::ICON))),
147 )147 )
148 .child(148 .child(
149 div()149 div()
150 .flex_1()150 .flex_1()
151 .flex()151 .flex()
152 .items_center()152 .items_center()
153- .gap(px(6.))153+ .gap(px(space::SM))
154- .text_size(text(13.))154+ .text_size(text(style::text::LABEL))
155 .text_color(palette.text)155 .text_color(palette.text)
156- .child(Icon::new(IconName::Mic).w(px(14.)).h(px(14.)))156+ .child(Icon::new(IconName::Mic).size(px(size::ICON_SM)))
157 .child(time_text(157 .child(time_text(
158 started158 started
159 .elapsed()159 .elapsed()
@@ -166,12 +166,12 @@ pub fn recording_row(
166 send.update(cx, |yumush, cx| yumush.send_voice_note(window, cx))166 send.update(cx, |yumush, cx| yumush.send_voice_note(window, cx))
167 })167 })
168 .tip("Send")168 .tip("Send")
169- .size(px(28.))169+ .size(px(size::CONTROL_SM))
170 .flex()170 .flex()
171 .items_center()171 .items_center()
172 .justify_center()172 .justify_center()
173- .rounded(px(6.))173+ .rounded(px(radius::MD))
174- .child(Icon::new(IconName::ArrowUp).w(px(14.)).h(px(14.))),174+ .child(Icon::new(IconName::ArrowUp).size(px(size::ICON_SM))),
175 )175 )
176 }176 }
177 177
@@ -182,13 +182,13 @@ pub fn mic_button(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement
182 entity.update(cx, |yumush, cx| yumush.start_voice_note(window, cx))182 entity.update(cx, |yumush, cx| yumush.start_voice_note(window, cx))
183 })183 })
184 .tip("Voice message")184 .tip("Voice message")
185- .size(px(28.))185+ .size(px(size::CONTROL_SM))
186 .flex()186 .flex()
187 .items_center()187 .items_center()
188 .justify_center()188 .justify_center()
189- .rounded(px(6.))189+ .rounded(px(radius::MD))
190 .text_color(palette.muted)190 .text_color(palette.muted)
191- .child(Icon::new(IconName::Mic).w(px(16.)).h(px(16.)))191+ .child(Icon::new(IconName::Mic).size(px(size::ICON)))
192 }192 }
193 193
194 impl Yumush {194 impl Yumush {
crates/client/src/gui/voice_settings.rsmodified+22 -21
@@ -18,6 +18,7 @@ use gpui_kit::{
18 use super::{18 use super::{
19 Palette, Yumush, clickable,19 Palette, Yumush, clickable,
20 settings_page::{row, segmented},20 settings_page::{row, segmented},
21+ style::{radius, size, space},
21 };22 };
22 use crate::{23 use crate::{
23 settings::{Activation, Profile, SENSITIVITY_DB, VOLUME, VoiceSettings},24 settings::{Activation, Profile, SENSITIVITY_DB, VOLUME, VoiceSettings},
@@ -175,11 +176,11 @@ fn volume_control(state: &Entity<SliderState>, value: f32, palette: Palette) ->
175 div()176 div()
176 .flex()177 .flex()
177 .items_center()178 .items_center()
178- .gap(px(8.))179+ .gap(px(space::SM))
179- .child(Slider::new(state).w(px(160.)))180+ .child(Slider::new(state).w(px(size::THUMB)))
180 .child(181 .child(
181 div()182 div()
182- .w(px(44.))183+ .w(px(size::ROW))
183 .text_right()184 .text_right()
184 .text_color(palette.muted)185 .text_color(palette.muted)
185 .child(format!("{value:.0}%")),186 .child(format!("{value:.0}%")),
@@ -198,15 +199,15 @@ fn level_bar(level: Option<f32>, threshold: f32, palette: Palette) -> Div {
198 };199 };
199 200
200 div()201 div()
201- .h(px(4.))202+ .h(px(space::XS))
202 .w_full()203 .w_full()
203- .rounded(px(2.))204+ .rounded(px(radius::SM))
204 .bg(palette.border)205 .bg(palette.border)
205 .child(206 .child(
206 div()207 div()
207 .h_full()208 .h_full()
208 .w(relative(fraction))209 .w(relative(fraction))
209- .rounded(px(2.))210+ .rounded(px(radius::SM))
210 .bg(color),211 .bg(color),
211 )212 )
212 }213 }
@@ -219,11 +220,11 @@ impl Yumush {
219 let mut rows = vec![220 let mut rows = vec![
220 row(221 row(
221 "Input device",222 "Input device",
222- div().child(Select::new(&controls.inputs).w(px(200.))),223+ div().child(Select::new(&controls.inputs).w(px(size::SIDEBAR))),
223 ),224 ),
224 row(225 row(
225 "Output device",226 "Output device",
226- div().child(Select::new(&controls.outputs).w(px(200.))),227+ div().child(Select::new(&controls.outputs).w(px(size::SIDEBAR))),
227 ),228 ),
228 row(229 row(
229 "Input volume",230 "Input volume",
@@ -279,12 +280,12 @@ impl Yumush {
279 div()280 div()
280 .flex()281 .flex()
281 .items_center()282 .items_center()
282- .gap(px(6.))283+ .gap(px(space::SM))
283 .child(284 .child(
284 test_button("mic_test_button", palette, testing, move |_, cx| {285 test_button("mic_test_button", palette, testing, move |_, cx| {
285 mic.update(cx, |yumush, cx| yumush.toggle_mic_test(cx));286 mic.update(cx, |yumush, cx| yumush.toggle_mic_test(cx));
286 })287 })
287- .child(Icon::new(IconName::Mic).w(px(14.)).h(px(14.)))288+ .child(Icon::new(IconName::Mic).size(px(size::ICON_SM)))
288 .child(if testing { "Stop" } else { "Hear yourself" }),289 .child(if testing { "Stop" } else { "Hear yourself" }),
289 )290 )
290 .child(291 .child(
@@ -293,7 +294,7 @@ impl Yumush {
293 yumush.network.play_chime(&yumush.settings.voice)294 yumush.network.play_chime(&yumush.settings.voice)
294 });295 });
295 })296 })
296- .child(Icon::new(IconName::Volume2).w(px(14.)).h(px(14.)))297+ .child(Icon::new(IconName::Volume2).size(px(size::ICON_SM)))
297 .child("Play sound"),298 .child("Play sound"),
298 )299 )
299 }300 }
@@ -301,12 +302,12 @@ impl Yumush {
301 fn sensitivity_control(&self, palette: Palette) -> Div {302 fn sensitivity_control(&self, palette: Palette) -> Div {
302 let level = self.network.voice_level_db();303 let level = self.network.voice_level_db();
303 304
304- div().flex().items_center().gap(px(8.)).child(305+ div().flex().items_center().gap(px(space::SM)).child(
305 div()306 div()
306- .w(px(200.))307+ .w(px(size::SIDEBAR))
307 .flex()308 .flex()
308 .flex_col()309 .flex_col()
309- .gap(px(6.))310+ .gap(px(space::SM))
310 .child(Slider::new(&self.voice.sensitivity))311 .child(Slider::new(&self.voice.sensitivity))
311 .child(level_bar(312 .child(level_bar(
312 level,313 level,
@@ -335,11 +336,11 @@ impl Yumush {
335 clickable("ptt_key_button", palette, move |window, cx| {336 clickable("ptt_key_button", palette, move |window, cx| {
336 entity.update(cx, |yumush, cx| yumush.capture_key(window, cx));337 entity.update(cx, |yumush, cx| yumush.capture_key(window, cx));
337 })338 })
338- .h(px(28.))339+ .h(px(size::CONTROL_SM))
339- .px(px(8.))340+ .px(px(space::SM))
340 .flex()341 .flex()
341 .items_center()342 .items_center()
342- .rounded(px(6.))343+ .rounded(px(radius::MD))
343 .child(content)344 .child(content)
344 }345 }
345 346
@@ -533,12 +534,12 @@ fn test_button(
533 on_click: impl Fn(&mut Window, &mut App) + 'static,534 on_click: impl Fn(&mut Window, &mut App) + 'static,
534 ) -> Stateful<Div> {535 ) -> Stateful<Div> {
535 clickable(id, palette, on_click)536 clickable(id, palette, on_click)
536- .h(px(28.))537+ .h(px(size::CONTROL_SM))
537- .px(px(10.))538+ .px(px(space::MD))
538 .flex()539 .flex()
539 .items_center()540 .items_center()
540- .gap(px(6.))541+ .gap(px(space::SM))
541- .rounded(px(6.))542+ .rounded(px(radius::MD))
542 .border_1()543 .border_1()
543 .border_color(if active {544 .border_color(if active {
544 palette.accent545 palette.accent
crates/client/src/gui/voice_stats.rsmodified+89 -82
@@ -1,23 +1,32 @@
1 use std::collections::VecDeque;1 use std::collections::VecDeque;
2 2
3 use common::{3 use common::{
4- model::Id,4+ model::{Hue, Id},
5 share::{Kind, Layer},5 share::{Kind, Layer},
6 };6 };
7 use gpui_kit::{7 use gpui_kit::{
8- Div, FontWeight, Hsla, ParentElement, Styled, assets::IconName, component::Icon, div, hsla,8+ Div, FontWeight, Hsla, ParentElement, Styled, assets::IconName, component::Icon, div,
9- prelude::FluentBuilder as _, px, relative, rgb,9+ prelude::FluentBuilder as _, px, relative,
10 };10 };
11 11
12-use super::{Palette, chat::Chat, share_view::kind_icon, text, wave};12+use super::{
13+ Palette,
14+ chat::Chat,
15+ share_view::kind_icon,
16+ style::{radius, size, space, stroke, text},
17+ text as text_size, wave,
18+};
13 use crate::media::decode::Engine;19 use crate::media::decode::Engine;
14 use crate::share::session::{LayerStats, WatchStats};20 use crate::share::session::{LayerStats, WatchStats};
15 use crate::usage::{Gpu, Usage};21 use crate::usage::{Gpu, Usage};
16 use crate::voice::VoiceSample;22 use crate::voice::VoiceSample;
17 23
18 pub const SAMPLE_HISTORY: usize = 60;24 pub const SAMPLE_HISTORY: usize = 60;
19-const GRAPH_HEIGHT: f32 = 32.;25+const MIRROR_HALF: f32 = size::CHIP;
20-const MIRROR_HALF: f32 = 22.;26+const LAYER_W: f32 = 70.;
27+const WATCH_LAYER_W: f32 = 64.;
28+const RATE_W: f32 = 52.;
29+const VALUE_W: f32 = 76.;
21 const PING_SCALE: f32 = 150.;30 const PING_SCALE: f32 = 150.;
22 const GOOD_LOSS: f32 = 2.;31 const GOOD_LOSS: f32 = 2.;
23 const FAIR_LOSS: f32 = 8.;32 const FAIR_LOSS: f32 = 8.;
@@ -63,7 +72,7 @@ impl Quality {
63 pub fn color(self, palette: Palette) -> Hsla {72 pub fn color(self, palette: Palette) -> Hsla {
64 match self {73 match self {
65 Self::Good => palette.ok,74 Self::Good => palette.ok,
66- Self::Fair => hsla(0.11, 0.85, 0.55, 1.),75+ Self::Fair => palette.tokens.hue(Hue::Gold),
67 Self::Poor => palette.danger,76 Self::Poor => palette.danger,
68 }77 }
69 }78 }
@@ -78,7 +87,7 @@ pub fn stats_panel(chat: &Chat, palette: Palette) -> Div {
78 div()87 div()
79 .flex()88 .flex()
80 .flex_col()89 .flex_col()
81- .gap(px(16.))90+ .gap(px(space::LG))
82 .child(network_block(chat, palette))91 .child(network_block(chat, palette))
83 .children(sending_blocks(&share.sending, palette))92 .children(sending_blocks(&share.sending, palette))
84 .child(receiving_block(&share.watching, chat, palette))93 .child(receiving_block(&share.watching, chat, palette))
@@ -103,12 +112,12 @@ fn network_block(chat: &Chat, palette: Palette) -> Div {
103 div()112 div()
104 .flex()113 .flex()
105 .flex_col()114 .flex_col()
106- .gap(px(8.))115+ .gap(px(space::SM))
107- .child(header(IconName::Activity, "Network", color).child(chip(word, color)))116+ .child(header(IconName::Activity, "Network", color).child(chip(word, color, palette)))
108 .child(117 .child(
109 div()118 div()
110 .flex()119 .flex()
111- .gap(px(8.))120+ .gap(px(space::SM))
112 .child(stat_cell("ping", ping, color, palette))121 .child(stat_cell("ping", ping, color, palette))
113 .child(stat_cell("jitter", jitter, color, palette))122 .child(stat_cell("jitter", jitter, color, palette))
114 .child(stat_cell("loss", loss, color, palette))123 .child(stat_cell("loss", loss, color, palette))
@@ -116,9 +125,9 @@ fn network_block(chat: &Chat, palette: Palette) -> Div {
116 )125 )
117 .child(126 .child(
118 div()127 div()
119- .h(px(GRAPH_HEIGHT))128+ .h(px(size::CONTROL))
120- .p(px(2.))129+ .p(px(space::XXS))
121- .rounded(px(4.))130+ .rounded(px(radius::SM))
122 .bg(palette.window)131 .bg(palette.window)
123 .child(wave::line(132 .child(wave::line(
124 chat.voice_samples133 chat.voice_samples
@@ -141,11 +150,11 @@ fn traffic(chat: &Chat, palette: Palette) -> Div {
141 div()150 div()
142 .flex()151 .flex()
143 .flex_col()152 .flex_col()
144- .gap(px(2.))153+ .gap(px(space::XXS))
145- .text_size(text(10.))154+ .text_size(text_size(text::CAPTION))
146 .child(155 .child(
147 div()156 div()
148- .text_color(up_color())157+ .text_color(up_color(palette))
149 .child(format!("↑ {}", rate(up_latest as u32))),158 .child(format!("↑ {}", rate(up_latest as u32))),
150 )159 )
151 .child(160 .child(
@@ -158,22 +167,22 @@ fn traffic(chat: &Chat, palette: Palette) -> Div {
158 .h(px(MIRROR_HALF))167 .h(px(MIRROR_HALF))
159 .flex()168 .flex()
160 .items_end()169 .items_end()
161- .gap(px(1.))170+ .gap(px(space::XXS))
162- .children(bars(&up, max, up_color())),171+ .children(bars(&up, max, up_color(palette))),
163 )172 )
164- .child(div().h(px(1.)).bg(palette.border))173+ .child(div().h(px(stroke::LINE)).bg(palette.border))
165 .child(174 .child(
166 div()175 div()
167 .h(px(MIRROR_HALF))176 .h(px(MIRROR_HALF))
168 .flex()177 .flex()
169 .items_start()178 .items_start()
170- .gap(px(1.))179+ .gap(px(space::XXS))
171- .children(bars(&down, max, down_color())),180+ .children(bars(&down, max, down_color(palette))),
172 ),181 ),
173 )182 )
174 .child(183 .child(
175 div()184 div()
176- .text_color(down_color())185+ .text_color(down_color(palette))
177 .child(format!("↓ {}", rate(down_latest as u32))),186 .child(format!("↓ {}", rate(down_latest as u32))),
178 )187 )
179 }188 }
@@ -190,12 +199,12 @@ fn bars(values: &[f32], max: f32, color: Hsla) -> Vec<Div> {
190 .collect()199 .collect()
191 }200 }
192 201
193-fn up_color() -> Hsla {202+fn up_color(palette: Palette) -> Hsla {
194- rgb(0xa78bfa).into()203+ palette.tokens.hue(Hue::Violet)
195 }204 }
196 205
197-fn down_color() -> Hsla {206+fn down_color(palette: Palette) -> Hsla {
198- rgb(0x22d3ee).into()207+ palette.tokens.hue(Hue::Teal)
199 }208 }
200 209
201 fn sending_blocks(sending: &[(Kind, LayerStats)], palette: Palette) -> Vec<Div> {210 fn sending_blocks(sending: &[(Kind, LayerStats)], palette: Palette) -> Vec<Div> {
@@ -221,7 +230,7 @@ fn sending_block(kind: Kind, layers: &[&LayerStats], palette: Palette) -> Div {
221 div()230 div()
222 .flex()231 .flex()
223 .flex_col()232 .flex_col()
224- .gap(px(6.))233+ .gap(px(space::SM))
225 .child(header(kind_icon(kind), kind_name(kind), color).child(label(engine, color)))234 .child(header(kind_icon(kind), kind_name(kind), color).child(label(engine, color)))
226 .children(235 .children(
227 layers236 layers
@@ -237,16 +246,16 @@ fn layer_row(index: usize, stats: &LayerStats, max: f32, kind: Kind, palette: Pa
237 div()246 div()
238 .flex()247 .flex()
239 .items_center()248 .items_center()
240- .gap(px(8.))249+ .gap(px(space::SM))
241- .h(px(28.))250+ .h(px(size::CONTROL_SM))
242- .px(px(8.))251+ .px(px(space::SM))
243- .rounded(px(7.))252+ .rounded(px(radius::MD))
244- .bg(color.opacity(0.08))253+ .bg(palette.hover)
245- .text_size(text(11.))254+ .text_size(text_size(text::CAPTION))
246- .when(stats.kbps == 0, |this| this.opacity(0.45))255+ .when(stats.kbps == 0, |this| this.text_color(palette.tokens.faint()))
247 .child(256 .child(
248 div()257 div()
249- .w(px(22.))258+ .w(px(size::CHIP))
250 .flex_none()259 .flex_none()
251 .font_weight(FontWeight::SEMIBOLD)260 .font_weight(FontWeight::SEMIBOLD)
252 .text_color(color)261 .text_color(color)
@@ -254,14 +263,14 @@ fn layer_row(index: usize, stats: &LayerStats, max: f32, kind: Kind, palette: Pa
254 )263 )
255 .child(264 .child(
256 div()265 div()
257- .w(px(70.))266+ .w(px(LAYER_W))
258 .flex_none()267 .flex_none()
259 .text_color(palette.text)268 .text_color(palette.text)
260 .child(resolution_text(stats.layer, stats.fps)),269 .child(resolution_text(stats.layer, stats.fps)),
261 )270 )
262 .child(271 .child(
263 div()272 div()
264- .w(px(32.))273+ .w(px(size::CONTROL))
265 .flex_none()274 .flex_none()
266 .text_color(palette.muted)275 .text_color(palette.muted)
267 .child(stats.layer.codec.name()),276 .child(stats.layer.codec.name()),
@@ -269,7 +278,7 @@ fn layer_row(index: usize, stats: &LayerStats, max: f32, kind: Kind, palette: Pa
269 .child(bar(stats.kbps as f32 / max, color, palette))278 .child(bar(stats.kbps as f32 / max, color, palette))
270 .child(279 .child(
271 div()280 div()
272- .w(px(52.))281+ .w(px(RATE_W))
273 .flex_none()282 .flex_none()
274 .text_right()283 .text_right()
275 .text_color(palette.text)284 .text_color(palette.text)
@@ -281,7 +290,7 @@ fn receiving_block(watching: &[(Id, Kind, WatchStats)], chat: &Chat, palette: Pa
281 div()290 div()
282 .flex()291 .flex()
283 .flex_col()292 .flex_col()
284- .gap(px(6.))293+ .gap(px(space::XS))
285 .child(header(IconName::Eye, "Receiving", palette.text))294 .child(header(IconName::Eye, "Receiving", palette.text))
286 .children(295 .children(
287 watching296 watching
@@ -303,13 +312,13 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette:
303 div()312 div()
304 .flex()313 .flex()
305 .items_center()314 .items_center()
306- .gap(px(4.))315+ .gap(px(space::XS))
307- .h(px(30.))316+ .h(px(size::CONTROL))
308- .px(px(6.))317+ .px(px(space::SM))
309- .rounded(px(7.))318+ .rounded(px(radius::MD))
310- .bg(kind_color(kind, palette).opacity(0.06))319+ .bg(palette.hover)
311- .text_size(text(11.))320+ .text_size(text_size(text::CAPTION))
312- .child(avatar_dot(&name, color))321+ .child(avatar_dot(&name, color, palette))
313 .child(322 .child(
314 div()323 div()
315 .flex_1()324 .flex_1()
@@ -321,13 +330,12 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette:
321 )330 )
322 .child(331 .child(
323 Icon::new(kind_icon(kind))332 Icon::new(kind_icon(kind))
324- .w(px(11.))333+ .size(px(size::ICON_SM))
325- .h(px(11.))
326 .flex_none()334 .flex_none()
327 .text_color(kind_color(kind, palette)),335 .text_color(kind_color(kind, palette)),
328 )336 )
329 .child(337 .child(
330- div().w(px(64.)).flex_none().text_color(palette.text).child(338+ div().w(px(WATCH_LAYER_W)).flex_none().text_color(palette.text).child(
331 stats339 stats
332 .layer340 .layer
333 .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps)),341 .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps)),
@@ -335,7 +343,7 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette:
335 )343 )
336 .child(344 .child(
337 div()345 div()
338- .w(px(52.))346+ .w(px(RATE_W))
339 .flex_none()347 .flex_none()
340 .text_color(palette.muted)348 .text_color(palette.muted)
341 .child(format!(349 .child(format!(
@@ -346,7 +354,7 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette:
346 )354 )
347 .child(355 .child(
348 div()356 div()
349- .w(px(44.))357+ .w(px(size::ROW))
350 .flex_none()358 .flex_none()
351 .text_right()359 .text_right()
352 .text_color(palette.text)360 .text_color(palette.text)
@@ -354,13 +362,13 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette:
354 )362 )
355 .child(363 .child(
356 div()364 div()
357- .w(px(52.))365+ .w(px(RATE_W))
358 .flex_none()366 .flex_none()
359 .text_right()367 .text_right()
360 .text_color(palette.muted)368 .text_color(palette.muted)
361 .child(latency),369 .child(latency),
362 )370 )
363- .child(chip(format!("{loss:.1}%"), loss_color))371+ .child(chip(format!("{loss:.1}%"), loss_color, palette))
364 }372 }
365 373
366 fn usage_block(usage: &Usage, palette: Palette) -> Div {374 fn usage_block(usage: &Usage, palette: Palette) -> Div {
@@ -404,24 +412,24 @@ fn usage_block(usage: &Usage, palette: Palette) -> Div {
404 ));412 ));
405 div()413 div()
406 .flex()414 .flex()
407- .gap(px(20.))415+ .gap(px(space::XL))
408 .child(cpu)416 .child(cpu)
409 .children(usage.gpu.as_ref().map(|gpu| gpu_column(gpu, palette)))417 .children(usage.gpu.as_ref().map(|gpu| gpu_column(gpu, palette)))
410 }418 }
411 419
412 fn column() -> Div {420 fn column() -> Div {
413- div().flex().flex_col().gap(px(6.)).flex_1().min_w_0()421+ div().flex().flex_col().gap(px(space::SM)).flex_1().min_w_0()
414 }422 }
415 423
416 fn model_header(icon: IconName, title: &'static str, model: &str, palette: Palette) -> Div {424 fn model_header(icon: IconName, title: &'static str, model: &str, palette: Palette) -> Div {
417 div()425 div()
418 .flex()426 .flex()
419 .flex_col()427 .flex_col()
420- .gap(px(2.))428+ .gap(px(space::XXS))
421 .child(header(icon, title, palette.text))429 .child(header(icon, title, palette.text))
422 .child(430 .child(
423 div()431 div()
424- .text_size(text(10.))432+ .text_size(text_size(text::CAPTION))
425 .text_color(palette.muted)433 .text_color(palette.muted)
426 .truncate()434 .truncate()
427 .child(model.to_string()),435 .child(model.to_string()),
@@ -514,11 +522,11 @@ fn row(label: &'static str, value: String, bar: Div, palette: Palette) -> Div {
514 div()522 div()
515 .flex()523 .flex()
516 .items_center()524 .items_center()
517- .gap(px(6.))525+ .gap(px(space::SM))
518- .text_size(text(11.))526+ .text_size(text_size(text::CAPTION))
519 .child(527 .child(
520 div()528 div()
521- .w(px(46.))529+ .w(px(size::ROW))
522 .flex_none()530 .flex_none()
523 .text_color(palette.muted)531 .text_color(palette.muted)
524 .child(label),532 .child(label),
@@ -526,7 +534,7 @@ fn row(label: &'static str, value: String, bar: Div, palette: Palette) -> Div {
526 .child(bar)534 .child(bar)
527 .child(535 .child(
528 div()536 div()
529- .w(px(76.))537+ .w(px(VALUE_W))
530 .flex_none()538 .flex_none()
531 .text_right()539 .text_right()
532 .text_color(palette.text)540 .text_color(palette.text)
@@ -578,18 +586,17 @@ fn header(icon: IconName, title: &'static str, color: Hsla) -> Div {
578 div()586 div()
579 .flex()587 .flex()
580 .items_center()588 .items_center()
581- .gap(px(7.))589+ .gap(px(space::SM))
582 .child(590 .child(
583 Icon::new(icon)591 Icon::new(icon)
584- .w(px(13.))592+ .size(px(size::ICON_SM))
585- .h(px(13.))
586 .flex_none()593 .flex_none()
587 .text_color(color),594 .text_color(color),
588 )595 )
589 .child(596 .child(
590 div()597 div()
591 .font_weight(FontWeight::SEMIBOLD)598 .font_weight(FontWeight::SEMIBOLD)
592- .text_size(text(12.))599+ .text_size(text_size(text::CAPTION))
593 .text_color(color)600 .text_color(color)
594 .child(title),601 .child(title),
595 )602 )
@@ -597,17 +604,17 @@ fn header(icon: IconName, title: &'static str, color: Hsla) -> Div {
597 }604 }
598 605
599 fn label(value: &'static str, color: Hsla) -> Div {606 fn label(value: &'static str, color: Hsla) -> Div {
600- div().text_size(text(11.)).text_color(color).child(value)607+ div().text_size(text_size(text::CAPTION)).text_color(color).child(value)
601 }608 }
602 609
603-fn chip(value: impl gpui_kit::IntoElement, color: Hsla) -> Div {610+fn chip(value: impl gpui_kit::IntoElement, color: Hsla, palette: Palette) -> Div {
604 div()611 div()
605 .flex_none()612 .flex_none()
606- .px(px(6.))613+ .px(px(space::SM))
607- .py(px(1.))614+ .py(px(space::XXS))
608- .rounded(px(5.))615+ .rounded(px(radius::SM))
609- .bg(color.opacity(0.13))616+ .bg(palette.hover)
610- .text_size(text(10.))617+ .text_size(text_size(text::CAPTION))
611 .text_color(color)618 .text_color(color)
612 .child(value)619 .child(value)
613 }620 }
@@ -618,37 +625,37 @@ fn stat_cell(label: &'static str, value: String, color: Hsla, palette: Palette)
618 .min_w_0()625 .min_w_0()
619 .flex()626 .flex()
620 .flex_col()627 .flex_col()
621- .gap(px(2.))628+ .gap(px(space::XXS))
622 .child(629 .child(
623 div()630 div()
624- .text_size(text(10.))631+ .text_size(text_size(text::CAPTION))
625 .text_color(palette.muted)632 .text_color(palette.muted)
626 .child(label),633 .child(label),
627 )634 )
628- .child(div().text_size(text(14.)).text_color(color).child(value))635+ .child(div().text_size(text_size(text::UI)).text_color(color).child(value))
629 }636 }
630 637
631-fn avatar_dot(name: &str, color: Hsla) -> Div {638+fn avatar_dot(name: &str, color: Hsla, palette: Palette) -> Div {
632 let initial = name639 let initial = name
633 .chars()640 .chars()
634 .next()641 .next()
635 .map_or('?', |letter| letter.to_ascii_uppercase());642 .map_or('?', |letter| letter.to_ascii_uppercase());
636 div()643 div()
637- .size(px(18.))644+ .size(px(size::CHIP))
638 .flex_none()645 .flex_none()
639 .rounded_full()646 .rounded_full()
640 .flex()647 .flex()
641 .items_center()648 .items_center()
642 .justify_center()649 .justify_center()
643 .bg(color)650 .bg(color)
644- .text_size(text(9.))651+ .text_size(text_size(text::CAPTION))
645 .font_weight(FontWeight::BOLD)652 .font_weight(FontWeight::BOLD)
646- .text_color(hsla(0., 0., 0.07, 1.))653+ .text_color(palette.on_accent)
647 .child(initial.to_string())654 .child(initial.to_string())
648 }655 }
649 656
650 fn dual_bar(own: f32, machine: f32, color: Hsla, palette: Palette) -> Div {657 fn dual_bar(own: f32, machine: f32, color: Hsla, palette: Palette) -> Div {
651- bar(machine, palette.muted.opacity(0.5), palette).child(658+ bar(machine, palette.tokens.faint(), palette).child(
652 div()659 div()
653 .absolute()660 .absolute()
654 .top_0()661 .top_0()
@@ -665,7 +672,7 @@ fn bar(fraction: f32, color: Hsla, palette: Palette) -> Div {
665 .relative()672 .relative()
666 .flex_1()673 .flex_1()
667 .min_w_0()674 .min_w_0()
668- .h(px(4.))675+ .h(px(space::XS))
669 .rounded_full()676 .rounded_full()
670 .bg(palette.border)677 .bg(palette.border)
671 .child(678 .child(
crates/client/src/gui/wave.rsmodified+9 -13
@@ -5,7 +5,10 @@ use gpui_kit::{
5 Div, Hsla, IntoElement, ParentElement, PathBuilder, Styled, canvas, div, point, px,5 Div, Hsla, IntoElement, ParentElement, PathBuilder, Styled, canvas, div, point, px,
6 };6 };
7 7
8-use super::voice_stats::SAMPLE_HISTORY;8+use super::{
9+ style::{radius, stroke},
10+ voice_stats::SAMPLE_HISTORY,
11+};
9 12
10 use crate::net::Levels;13 use crate::net::Levels;
11 14
@@ -17,6 +20,7 @@ const AUDIBLE: f32 = 0.1;
17 const BAR_WIDTH: f32 = 2.;20 const BAR_WIDTH: f32 = 2.;
18 const MIN_BAR: f32 = 1.5;21 const MIN_BAR: f32 = 1.5;
19 const MINI_BARS: usize = 11;22 const MINI_BARS: usize = 11;
23+const GAP: f32 = 1.;
20 24
21 pub struct Wave {25 pub struct Wave {
22 bars: VecDeque<f32>,26 bars: VecDeque<f32>,
@@ -129,14 +133,6 @@ impl Waves {
129 *self = Self::default();133 *self = Self::default();
130 }134 }
131 135
132- pub fn tone(&self, id: Id, me: Option<Id>, color: Hsla) -> Hsla {
133- if Some(id) == me && !self.own_live {
134- color.opacity(0.35)
135- } else {
136- color
137- }
138- }
139-
140 pub fn voice(&self, id: Id) -> Option<&VecDeque<f32>> {136 pub fn voice(&self, id: Id) -> Option<&VecDeque<f32>> {
141 self.voice.get(&id).map(|wave| &wave.bars)137 self.voice.get(&id).map(|wave| &wave.bars)
142 }138 }
@@ -164,7 +160,7 @@ pub fn mini_wave(history: &VecDeque<f32>, size: f32, color: Hsla) -> Div {
164 fn slot(count: usize, bars: Option<Vec<f32>>, size: f32, color: Hsla) -> Div {160 fn slot(count: usize, bars: Option<Vec<f32>>, size: f32, color: Hsla) -> Div {
165 div()161 div()
166 .flex_shrink_0()162 .flex_shrink_0()
167- .w(px(count as f32 * (BAR_WIDTH + 1.) - 1.))163+ .w(px(count as f32 * (BAR_WIDTH + GAP) - GAP))
168 .children(bars.map(|bars| wave(&bars, size, color)))164 .children(bars.map(|bars| wave(&bars, size, color)))
169 }165 }
170 166
@@ -172,13 +168,13 @@ fn wave(bars: &[f32], size: f32, color: Hsla) -> Div {
172 div()168 div()
173 .flex()169 .flex()
174 .items_center()170 .items_center()
175- .gap(px(1.))171+ .gap(px(GAP))
176 .h(px(size))172 .h(px(size))
177 .children(bars.iter().map(|bar| {173 .children(bars.iter().map(|bar| {
178 div()174 div()
179 .w(px(BAR_WIDTH))175 .w(px(BAR_WIDTH))
180 .h(px((size * bar).max(MIN_BAR)))176 .h(px((size * bar).max(MIN_BAR)))
181- .rounded(px(1.))177+ .rounded(px(radius::SM))
182 .bg(color)178 .bg(color)
183 }))179 }))
184 }180 }
@@ -192,7 +188,7 @@ pub fn line_of(levels: Vec<f32>, slots: usize, color: Hsla) -> impl IntoElement
192 |_, _, _| {},188 |_, _, _| {},
193 move |bounds, _, window, _| {189 move |bounds, _, window, _| {
194 let first = slots.saturating_sub(levels.len());190 let first = slots.saturating_sub(levels.len());
195- let mut path = PathBuilder::stroke(px(1.5));191+ let mut path = PathBuilder::stroke(px(stroke::LINE));
196 for (index, &level) in levels.iter().enumerate() {192 for (index, &level) in levels.iter().enumerate() {
197 let step = (first + index) as f32 / slots.saturating_sub(1).max(1) as f32;193 let step = (first + index) as f32 / slots.saturating_sub(1).max(1) as f32;
198 let x = bounds.origin.x + bounds.size.width * step;194 let x = bounds.origin.x + bounds.size.width * step;