forge
Explore
Log in

Don't you dare go Hollow

Settings, community settings and builder as full pages with a left index ('‹ Settings', selected brighter + medium)

Browse files at this commit

86d0fa0885dbfaf50522d29baaec97c239291b38Ahmet Kaan GümüşParent: ce88fa7
  • feat
    • settings, community settings and builder as full pages with a left index ('‹ Settings', selected brighter + medium)
    • bare device pickers and test buttons
Show full message
✨ feat: settings, community settings and builder as full pages with a left index ('‹ Settings', selected brighter + medium); bare device pickers and test buttons

31 changed files +1024 -592

crates/client/build.rsmodified+28 -6
@@ -17,13 +17,22 @@ fn main() {
17 let mut out = String::new();17 let mut out = String::new();
18 18
19 let hues = names(&tokens["hues"]);19 let hues = names(&tokens["hues"]);
20- writeln!(out, "pub const HUE_NAMES: [&str; {}] = {hues:?};", hues.len()).unwrap();20+ writeln!(
21+ out,
22+ "pub const HUE_NAMES: [&str; {}] = {hues:?};",
23+ hues.len()
24+ )
25+ .unwrap();
21 26
22 let themes = tokens["theme"].as_table().expect("theme table");27 let themes = tokens["theme"].as_table().expect("theme table");
23 writeln!(28 writeln!(
24 out,29 out,
25 "#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum Theme {{ {} }}",30 "#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum Theme {{ {} }}",
26- themes.keys().map(|name| camel(name)).collect::<Vec<_>>().join(", ")31+ themes
32+ .keys()
33+ .map(|name| camel(name))
34+ .collect::<Vec<_>>()
35+ .join(", ")
27 )36 )
28 .unwrap();37 .unwrap();
29 writeln!(38 writeln!(
@@ -39,7 +48,9 @@ fn main() {
39 writeln!(48 writeln!(
40 out,49 out,
41 "pub struct Colors {{\n pub dark: bool,\n{} pub hue: [u32; {}],\n}}",50 "pub struct Colors {{\n pub dark: bool,\n{} pub hue: [u32; {}],\n}}",
42- COLORS.map(|name| format!(" pub {name}: u32,\n")).concat(),51+ COLORS
52+ .map(|name| format!(" pub {name}: u32,\n"))
53+ .concat(),
43 hues.len()54 hues.len()
44 )55 )
45 .unwrap();56 .unwrap();
@@ -53,9 +64,15 @@ fn main() {
53 name.to_uppercase(),64 name.to_uppercase(),
54 theme["dark"].as_bool().expect("dark"),65 theme["dark"].as_bool().expect("dark"),
55 COLORS66 COLORS
56- .map(|color| format!(" {color}: {},\n", hex(theme[color].as_str().expect(color))))67+ .map(|color| format!(
68+ " {color}: {},\n",
69+ hex(theme[color].as_str().expect(color))
70+ ))
57 .concat(),71 .concat(),
58- hue.iter().map(|color| hex(color)).collect::<Vec<_>>().join(", ")72+ hue.iter()
73+ .map(|color| hex(color))
74+ .collect::<Vec<_>>()
75+ .join(", ")
59 )76 )
60 .unwrap();77 .unwrap();
61 }78 }
@@ -68,7 +85,12 @@ fn main() {
68 Value::Float(value) => *value as f32,85 Value::Float(value) => *value as f32,
69 _ => panic!("{scale}.{name} is not a number"),86 _ => panic!("{scale}.{name} is not a number"),
70 };87 };
71- writeln!(out, " pub const {}: f32 = {value:?};", name.to_uppercase()).unwrap();88+ writeln!(
89+ out,
90+ " pub const {}: f32 = {value:?};",
91+ name.to_uppercase()
92+ )
93+ .unwrap();
72 }94 }
73 writeln!(out, "}}").unwrap();95 writeln!(out, "}}").unwrap();
74 }96 }
crates/client/src/avatar.rsmodified+0 -2
@@ -52,5 +52,3 @@ fn encode(image: &RgbImage, quality: u8) -> Result<Vec<u8>, Fail> {
52 fn image_error(error: image::ImageError) -> Fail {52 fn image_error(error: image::ImageError) -> Fail {
53 Fail::Io(error.to_string())53 Fail::Io(error.to_string())
54 }54 }
55-
56-
crates/client/src/gui.rsmodified+17 -19
@@ -1,10 +1,5 @@
1 use common::model::{Hue, Id};1 use common::model::{Hue, Id};
2-use std::{2+use std::{collections::HashMap, fmt::Display, sync::Arc, time::Instant};
3- collections::HashMap,
4- fmt::Display,
5- sync::Arc,
6- time::Instant,
7-};
8 3
9 use common::{4 use common::{
10 call::{GetAvatar, GetSettings, MarkRead},5 call::{GetAvatar, GetSettings, MarkRead},
@@ -17,11 +12,10 @@ use common::{
17 },12 },
18 };13 };
19 use gpui_kit::{14 use gpui_kit::{
20- AnyElement, AnyWindowHandle, App,15+ AnyElement, AnyWindowHandle, App, AppContext, AsyncWindowContext, Context, Div, ElementId,
21- AppContext, AsyncWindowContext, Context, Div, ElementId, Entity, FontWeight, Hsla, Image,16+ Entity, FontWeight, Hsla, Image, ImageFormat, InteractiveElement, IntoElement, KeyBinding,
22- ImageFormat, InteractiveElement, IntoElement, KeyBinding, KeyDownEvent, KeyUpEvent,17+ KeyDownEvent, KeyUpEvent, ModifiersChangedEvent, ParentElement, Pixels, Rems, Render,
23- ModifiersChangedEvent, ParentElement, Pixels, Rems, Render, RenderOnce, Stateful,18+ RenderOnce, Stateful, StatefulInteractiveElement, Styled, WeakEntity, Window, actions,
24- StatefulInteractiveElement, Styled, WeakEntity, Window, actions,
25 base::Selectable,19 base::Selectable,
26 component::{20 component::{
27 Sizable, Theme, ThemeRegistry, WindowExt,21 Sizable, Theme, ThemeRegistry, WindowExt,
@@ -42,19 +36,18 @@ use crate::{
42 };36 };
43 37
44 mod auth;38 mod auth;
45-mod call_bar;
46-pub mod gallery;
47-mod parts;
48-pub mod style;
49 mod builder;39 mod builder;
40+mod call_bar;
50 mod camera_view;41 mod camera_view;
51 mod chat;42 mod chat;
52 mod community_settings;43 mod community_settings;
53 mod composer;44 mod composer;
54 mod dock;45 mod dock;
55 mod forward;46 mod forward;
47+pub mod gallery;
56 mod media_view;48 mod media_view;
57 mod message_actions;49 mod message_actions;
50+mod parts;
58 mod poll;51 mod poll;
59 mod profile;52 mod profile;
60 mod settings_page;53 mod settings_page;
@@ -63,6 +56,7 @@ mod sidebar;
63 mod snippet;56 mod snippet;
64 mod social;57 mod social;
65 mod stream_stats;58 mod stream_stats;
59+pub mod style;
66 mod surface;60 mod surface;
67 mod voice_note;61 mod voice_note;
68 mod voice_settings;62 mod voice_settings;
@@ -71,8 +65,8 @@ mod wave;
71 mod widget;65 mod widget;
72 66
73 use auth::Auth;67 use auth::Auth;
74-use style::{Tokens, radius, size, space};
75 use chat::{Chat, View};68 use chat::{Chat, View};
69+use style::{Tokens, radius, size, space};
76 use voice_settings::VoiceControls;70 use voice_settings::VoiceControls;
77 71
78 actions!(yumush, [FocusFind, CloseSettings]);72 actions!(yumush, [FocusFind, CloseSettings]);
@@ -202,7 +196,6 @@ pub fn sync_theme(cx: &mut App) {
202 const FIND_KEY: &str = "ctrl-k";196 const FIND_KEY: &str = "ctrl-k";
203 pub const FIND_HINT: &str = "Ctrl K";197 pub const FIND_HINT: &str = "Ctrl K";
204 198
205-
206 pub fn badge(palette: Palette, id: Id, name: &str, size: Pixels, font: Rems) -> Div {199 pub fn badge(palette: Palette, id: Id, name: &str, size: Pixels, font: Rems) -> Div {
207 let initial = name200 let initial = name
208 .chars()201 .chars()
@@ -267,10 +260,14 @@ pub fn community_icon(
267 .rounded(px(radius::SM))260 .rounded(px(radius::SM))
268 .overflow_hidden()261 .overflow_hidden()
269 .child(img(image.clone()).size_full()),262 .child(img(image.clone()).size_full()),
270- None => badge(palette, community.id, &community.name, size, font).rounded(px(radius::SM)),263+ None => {
264+ badge(palette, community.id, &community.name, size, font).rounded(px(radius::SM))
265+ }
271 },266 },
272 CommunityKind::Direct { peer } => avatar(palette, peer, size, font, avatars),267 CommunityKind::Direct { peer } => avatar(palette, peer, size, font, avatars),
273- CommunityKind::Notes => badge(palette, community.id, "Notes", size, font).rounded(px(radius::SM)),268+ CommunityKind::Notes => {
269+ badge(palette, community.id, "Notes", size, font).rounded(px(radius::SM))
270+ }
274 }271 }
275 }272 }
276 273
@@ -757,6 +754,7 @@ impl Yumush {
757 }754 }
758 755
759 fn show_view(&mut self, view: View, window: &mut Window, cx: &mut Context<Self>) {756 fn show_view(&mut self, view: View, window: &mut Window, cx: &mut Context<Self>) {
757+ self.chat.section = 0;
760 if self.chat.view == View::Settings && view != View::Settings {758 if self.chat.view == View::Settings && view != View::Settings {
761 self.leave_settings();759 self.leave_settings();
762 }760 }
crates/client/src/gui/builder.rsmodified+20 -42
@@ -20,20 +20,20 @@ use common::{
20 permission,20 permission,
21 };21 };
22 use gpui_kit::{22 use gpui_kit::{
23- AnyElement, App, Context, Div, Entity, InteractiveElement, IntoElement, ParentElement,23+ AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement,
24- StatefulInteractiveElement, Styled, Window,24+ ParentElement, StatefulInteractiveElement, Styled, Window, assets::IconName,
25- assets::IconName,25+ component::input::InputState, div, prelude::FluentBuilder as _, px,
26- component::{Icon, input::InputState},
27- div,
28- prelude::FluentBuilder as _,
29- px,
30 };26 };
31 27
32 use self::ui::{accent_button, icon_button, page_heading, plain_button};28 use self::ui::{accent_button, icon_button, page_heading, plain_button};
33 use super::{29 use super::{
34- Palette, Yumush, chat::View, clickable, entity_action, notify_error, settings_page::header,30+ Palette, Yumush,
35- style::{radius, size, space, text},31+ chat::View,
36- text, widget::search_text,32+ clickable, entity_action, notify_error,
33+ settings_page::header,
34+ style::{size, space, text},
35+ text,
36+ widget::search_text,
37 };37 };
38 use crate::net::NetworkHandle;38 use crate::net::NetworkHandle;
39 39
@@ -83,21 +83,6 @@ impl BuilderTab {
83 Self::Log => "Log",83 Self::Log => "Log",
84 }84 }
85 }85 }
86-
87- fn icon(self) -> IconName {
88- match self {
89- Self::Overview => IconName::LayoutDashboard,
90- Self::Users => IconName::Users,
91- Self::Communities => IconName::Building2,
92- Self::Messages => IconName::MessageSquare,
93- Self::Voice => IconName::Mic,
94- Self::Storage => IconName::HardDrive,
95- Self::Access => IconName::Key,
96- Self::Reports => IconName::Flag,
97- Self::Server => IconName::Server,
98- Self::Log => IconName::ScrollText,
99- }
100- }
101 }86 }
102 87
103 pub(super) struct Transfer {88 pub(super) struct Transfer {
@@ -225,10 +210,8 @@ impl Yumush {
225 .flex()210 .flex()
226 .flex_col()211 .flex_col()
227 .gap(px(space::XXS))212 .gap(px(space::XXS))
228- .p(px(space::SM))213+ .px(px(space::XL))
229- .bg(palette.panel)214+ .py(px(space::LG))
230- .border_r_1()
231- .border_color(palette.border)
232 .children(BuilderTab::ALL.map(|tab| self.builder_nav_item(tab, entity, palette)))215 .children(BuilderTab::ALL.map(|tab| self.builder_nav_item(tab, entity, palette)))
233 .child(div().flex_1())216 .child(div().flex_1())
234 .child(self.ghost_toggle(entity, palette))217 .child(self.ghost_toggle(entity, palette))
@@ -241,7 +224,6 @@ impl Yumush {
241 palette: Palette,224 palette: Palette,
242 ) -> impl IntoElement {225 ) -> impl IntoElement {
243 let label = tab.label();226 let label = tab.label();
244- let icon = tab.icon();
245 let active = self.chat.builder_tab == tab;227 let active = self.chat.builder_tab == tab;
246 let color = if active { palette.text } else { palette.muted };228 let color = if active { palette.text } else { palette.muted };
247 let open = (tab == BuilderTab::Reports)229 let open = (tab == BuilderTab::Reports)
@@ -256,23 +238,16 @@ impl Yumush {
256 }),238 }),
257 )239 )
258 .h(px(size::CONTROL))240 .h(px(size::CONTROL))
259- .px(px(space::MD))
260 .flex()241 .flex()
261 .items_center()242 .items_center()
262 .gap(px(space::SM))243 .gap(px(space::SM))
263- .rounded(px(radius::MD))
264- .text_size(text(text::LABEL))
265 .text_color(color)244 .text_color(color)
266- .when(active, |this| this.bg(palette.hover))245+ .when(active, |this| this.font_weight(FontWeight::MEDIUM))
267- .child(Icon::new(icon).size(px(size::ICON_SM)).text_color(color))
268 .child(div().flex_1().min_w_0().truncate().child(label))246 .child(div().flex_1().min_w_0().truncate().child(label))
269 .children(open.map(|count| {247 .children(open.map(|count| {
270 div()248 div()
271- .px(px(space::XS))
272- .rounded_full()
273- .bg(palette.accent)
274- .text_color(palette.on_accent)
275 .text_size(text(text::CAPTION))249 .text_size(text(text::CAPTION))
250+ .text_color(palette.text)
276 .child(count.to_string())251 .child(count.to_string())
277 }))252 }))
278 }253 }
@@ -292,9 +267,12 @@ impl Yumush {
292 .text_size(text(text::LABEL))267 .text_size(text(text::LABEL))
293 .text_color(palette.muted)268 .text_color(palette.muted)
294 .child("Ghost")269 .child("Ghost")
295- .child(270+ .child(super::parts::toggle(
296- super::parts::toggle("ghost_switch", enabled, palette.tokens, toggle),271+ "ghost_switch",
297- )272+ enabled,
273+ palette.tokens,
274+ toggle,
275+ ))
298 }276 }
299 277
300 pub(super) fn is_builder(&self) -> bool {278 pub(super) fn is_builder(&self) -> bool {
crates/client/src/gui/builder/communities.rsmodified+3 -1
@@ -16,7 +16,9 @@ use super::{
16 ui::{card, confirmed, icon_button, pill, plain_button, rows_body},16 ui::{card, confirmed, icon_button, pill, plain_button, rows_body},
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,
20+ chat::View,
21+ community_icon, entity_action, notify_error,
20 profile::user_link,22 profile::user_link,
21 style::{radius, size, space, text},23 style::{radius, size, space, text},
22 text,24 text,
crates/client/src/gui/builder/log.rsmodified+5 -5
@@ -284,11 +284,11 @@ impl Yumush {
284 284
285 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> {
286 let filters = toolbar(vec![286 let filters = toolbar(vec![
287- fixed(size::THUMB,field(palette, &self.chat.builder_log_actor)),287+ fixed(size::THUMB, field(palette, &self.chat.builder_log_actor)),
288- fixed(size::THUMB,field(palette, &self.chat.builder_log_target)),288+ fixed(size::THUMB, field(palette, &self.chat.builder_log_target)),
289- fixed(size::THUMB,Select::new(&self.chat.builder_log_action)),289+ fixed(size::THUMB, Select::new(&self.chat.builder_log_action)),
290- fixed(size::THUMB,field(palette, &self.chat.builder_log_from)),290+ fixed(size::THUMB, field(palette, &self.chat.builder_log_from)),
291- fixed(size::THUMB,field(palette, &self.chat.builder_log_to)),291+ fixed(size::THUMB, field(palette, &self.chat.builder_log_to)),
292 accent_button(292 accent_button(
293 "apply_builder_log",293 "apply_builder_log",
294 "Apply",294 "Apply",
crates/client/src/gui/builder/messages.rsmodified+13 -2
@@ -172,7 +172,12 @@ impl Yumush {
172 &self.chat.builder_message_from,172 &self.chat.builder_message_from,
173 &self.chat.builder_message_to,173 &self.chat.builder_message_to,
174 ]174 ]
175- .map(|input| div().flex_1().min_w(px(size::THUMB)).child(field(palette, input))),175+ .map(|input| {
176+ div()
177+ .flex_1()
178+ .min_w(px(size::THUMB))
179+ .child(field(palette, input))
180+ }),
176 )181 )
177 .child(accent_button(182 .child(accent_button(
178 "search_messages",183 "search_messages",
@@ -194,7 +199,13 @@ impl Yumush {
194 .as_ref()199 .as_ref()
195 .is_some_and(|author| self.chat.pending_builder_purge == Some(author.id));200 .is_some_and(|author| self.chat.pending_builder_purge == Some(author.id));
196 let picture = match &hit.author {201 let picture = match &hit.author {
197- Some(author) => avatar(palette, author, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),202+ Some(author) => avatar(
203+ palette,
204+ author,
205+ px(size::AVATAR),
206+ text(text::CAPTION),
207+ &self.chat.avatars,
208+ ),
198 None => div()209 None => div()
199 .size(px(size::AVATAR))210 .size(px(size::AVATAR))
200 .flex_shrink_0()211 .flex_shrink_0()
crates/client/src/gui/builder/overview.rsmodified+13 -6
@@ -24,11 +24,14 @@ fn day_label(day: u64) -> String {
24 }24 }
25 25
26 fn tile_row(tiles: &[(&str, String)], palette: Palette) -> Div {26 fn tile_row(tiles: &[(&str, String)], palette: Palette) -> Div {
27- div().flex().gap(px(space::MD)).children(27+ div()
28- tiles28+ .flex()
29- .iter()29+ .gap(px(space::MD))
30- .map(|(label, value)| stat_tile(label, value, palette).flex_1().min_w(px(size::SIDEBAR))),30+ .children(tiles.iter().map(|(label, value)| {
31- )31+ stat_tile(label, value, palette)
32+ .flex_1()
33+ .min_w(px(size::SIDEBAR))
34+ }))
32 }35 }
33 36
34 fn bar_chart(37 fn bar_chart(
@@ -93,7 +96,11 @@ fn bar_chart(
93 )96 )
94 };97 };
95 98
96- div().flex_1().h(px(height)).rounded_t(px(radius::SM)).bg(color)99+ div()
100+ .flex_1()
101+ .h(px(height))
102+ .rounded_t(px(radius::SM))
103+ .bg(color)
97 })),104 })),
98 )105 )
99 .child(106 .child(
crates/client/src/gui/builder/storage.rsmodified+20 -11
@@ -17,10 +17,12 @@ use super::ui::{
17 toolbar,17 toolbar,
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,
21- storage,21+ community_settings::user_name,
22+ entity_action, millis_time, notify_error, storage,
22 style::{radius, size, space, text},23 style::{radius, size, space, text},
23- text, widget::field,24+ text,
25+ widget::field,
24 };26 };
25 27
26 fn share(bytes: u64, max: u64) -> f32 {28 fn share(bytes: u64, max: u64) -> f32 {
@@ -72,13 +74,17 @@ fn usage_row(name: &str, bytes: u64, count: u64, fraction: f32, palette: Palette
72 ),74 ),
73 )75 )
74 .child(76 .child(
75- div().h(px(space::XXS)).rounded(px(radius::SM)).bg(palette.hover).child(77+ div()
76- div()78+ .h(px(space::XXS))
77- .h_full()79+ .rounded(px(radius::SM))
78- .w(relative(fraction))80+ .bg(palette.hover)
79- .rounded(px(radius::SM))81+ .child(
80- .bg(palette.accent),82+ div()
81- ),83+ .h_full()
84+ .w(relative(fraction))
85+ .rounded(px(radius::SM))
86+ .bg(palette.accent),
87+ ),
82 )88 )
83 }89 }
84 90
@@ -201,7 +207,10 @@ impl Yumush {
201 ));207 ));
202 208
203 let controls = toolbar(vec![209 let controls = toolbar(vec![
204- fixed(size::THUMB, field(palette, &self.chat.builder_attachment_user)),210+ fixed(
211+ size::THUMB,
212+ field(palette, &self.chat.builder_attachment_user),
213+ ),
205 fixed(214 fixed(
206 size::THUMB,215 size::THUMB,
207 field(palette, &self.chat.builder_attachment_community),216 field(palette, &self.chat.builder_attachment_community),
crates/client/src/gui/builder/ui.rsmodified+7 -1
@@ -152,7 +152,13 @@ pub(super) fn action_group(
152 .flex()152 .flex()
153 .flex_col()153 .flex_col()
154 .gap(px(space::XS))154 .gap(px(space::XS))
155- .child(div().flex().flex_wrap().gap(px(space::XS)).children(children)),155+ .child(
156+ div()
157+ .flex()
158+ .flex_wrap()
159+ .gap(px(space::XS))
160+ .children(children),
161+ ),
156 ),162 ),
157 )163 )
158 }164 }
crates/client/src/gui/builder/users.rsmodified+8 -2
@@ -27,8 +27,8 @@ use crate::{
27 DATE, DAY, Palette, Tooltip as _, Yumush, avatar, clickable, entity_action, millis_time,27 DATE, DAY, Palette, Tooltip as _, Yumush, avatar, clickable, entity_action, millis_time,
28 notify_error,28 notify_error,
29 profile::user_link,29 profile::user_link,
30- text,
31 style::{radius, size, space, text},30 style::{radius, size, space, text},
31+ text,
32 widget::{field, search_text},32 widget::{field, search_text},
33 },33 },
34 net::{Fail, NetworkHandle},34 net::{Fail, NetworkHandle},
@@ -866,7 +866,13 @@ impl Yumush {
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(size::AVATAR), text(text::CAPTION), &self.chat.avatars),869+ avatar(
870+ palette,
871+ user,
872+ px(size::AVATAR),
873+ text(text::CAPTION),
874+ &self.chat.avatars,
875+ ),
870 ))876 ))
871 .child(877 .child(
872 div()878 div()
crates/client/src/gui/builder/voice.rsmodified+2 -1
@@ -13,7 +13,8 @@ use gpui_kit::{
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::{15 gui::{
16- Palette, Yumush, avatar, entity_action, notify_error, profile::user_link,16+ Palette, Yumush, avatar, entity_action, notify_error,
17+ profile::user_link,
17 style::{self, size, space},18 style::{self, size, space},
18 text,19 text,
19 },20 },
crates/client/src/gui/call_bar.rsmodified+50 -11
@@ -1,8 +1,8 @@
1 use std::{collections::VecDeque, rc::Rc};1 use std::{collections::VecDeque, rc::Rc};
2 2
3 use gpui_kit::{3 use gpui_kit::{
4- AnyElement, App, Div, FontWeight, InteractiveElement, ParentElement,4+ AnyElement, App, Div, FontWeight, InteractiveElement, ParentElement, SharedString,
5- SharedString, StatefulInteractiveElement, Styled, Window, assets::IconName, div, px,5+ StatefulInteractiveElement, Styled, Window, assets::IconName, div, px,
6 };6 };
7 7
8 use super::{8 use super::{
@@ -43,14 +43,24 @@ fn run(action: &Action) -> impl Fn(&mut Window, &mut App) + 'static {
43 pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {43 pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
44 let tone = |on: bool| if on { Tone::On } else { Tone::Idle };44 let tone = |on: bool| if on { Tone::On } else { Tone::Idle };
45 let alarm = |on: bool| if on { Tone::Danger } else { Tone::Idle };45 let alarm = |on: bool| if on { Tone::Danger } else { Tone::Idle };
46- let ping_ink = if bar.voice == Voice::Frayed { Ink::Bad } else { Ink::Faint };46+ let ping_ink = if bar.voice == Voice::Frayed {
47- let ping = bar.ping.map_or_else(|| "–".to_string(), |ping| format!("{ping:.0} ms"));47+ Ink::Bad
48+ } else {
49+ Ink::Faint
50+ };
51+ let ping = bar
52+ .ping
53+ .map_or_else(|| "–".to_string(), |ping| format!("{ping:.0} ms"));
48 let stats = run(&actions.stats);54 let stats = run(&actions.stats);
49 let controls = band(space::XS)55 let controls = band(space::XS)
50 .flex_none()56 .flex_none()
51 .child(icon_button(57 .child(icon_button(
52 format!("bar_mute_{}", bar.muted),58 format!("bar_mute_{}", bar.muted),
53- if bar.muted { IconName::MicOff } else { IconName::Mic },59+ if bar.muted {
60+ IconName::MicOff
61+ } else {
62+ IconName::Mic
63+ },
54 if bar.muted { "Unmute" } else { "Mute" },64 if bar.muted { "Unmute" } else { "Mute" },
55 alarm(bar.muted),65 alarm(bar.muted),
56 t,66 t,
@@ -58,7 +68,11 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
58 ))68 ))
59 .child(icon_button(69 .child(icon_button(
60 format!("bar_deafen_{}", bar.deafened),70 format!("bar_deafen_{}", bar.deafened),
61- if bar.deafened { IconName::HeadphoneOff } else { IconName::Headphones },71+ if bar.deafened {
72+ IconName::HeadphoneOff
73+ } else {
74+ IconName::Headphones
75+ },
62 if bar.deafened { "Undeafen" } else { "Deafen" },76 if bar.deafened { "Undeafen" } else { "Deafen" },
63 alarm(bar.deafened),77 alarm(bar.deafened),
64 t,78 t,
@@ -67,7 +81,11 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
67 .child(icon_button(81 .child(icon_button(
68 format!("bar_camera_{}", bar.camera),82 format!("bar_camera_{}", bar.camera),
69 IconName::Video,83 IconName::Video,
70- if bar.camera { "Turn off camera" } else { "Turn on camera" },84+ if bar.camera {
85+ "Turn off camera"
86+ } else {
87+ "Turn on camera"
88+ },
71 tone(bar.camera),89 tone(bar.camera),
72 t,90 t,
73 run(&actions.camera),91 run(&actions.camera),
@@ -76,19 +94,40 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
76 .child(icon_button(94 .child(icon_button(
77 format!("bar_screen_{}", bar.screen),95 format!("bar_screen_{}", bar.screen),
78 IconName::ScreenShare,96 IconName::ScreenShare,
79- if bar.screen { "Stop sharing" } else { "Share screen" },97+ if bar.screen {
98+ "Stop sharing"
99+ } else {
100+ "Share screen"
101+ },
80 tone(bar.screen),102 tone(bar.screen),
81 t,103 t,
82 run(&actions.screen),104 run(&actions.screen),
83 ))105 ))
84 .child(actions.screen_more)106 .child(actions.screen_more)
85- .child(icon_button("bar_leave", IconName::PhoneOff, "Leave call", Tone::Danger, t, run(&actions.leave)));107+ .child(icon_button(
108+ "bar_leave",
109+ IconName::PhoneOff,
110+ "Leave call",
111+ Tone::Danger,
112+ t,
113+ run(&actions.leave),
114+ ));
86 div().flex_none().child(thread(t)).child(115 div().flex_none().child(thread(t)).child(
87 band(space::LG)116 band(space::LG)
88 .h(px(size::ROW + space::MD))117 .h(px(size::ROW + space::MD))
89 .px(px(space::LG))118 .px(px(space::LG))
90- .child(words(bar.name, Text::Ui, Ink::Paper, t).font_weight(FontWeight::MEDIUM).flex_none())119+ .child(
91- .child(div().flex_1().min_w(px(size::CONTROL)).h(px(size::ICON)).child(voice_line(bar.bands.as_ref(), bar.voice, t)))120+ words(bar.name, Text::Ui, Ink::Paper, t)
121+ .font_weight(FontWeight::MEDIUM)
122+ .flex_none(),
123+ )
124+ .child(
125+ div()
126+ .flex_1()
127+ .min_w(px(size::CONTROL))
128+ .h(px(size::ICON))
129+ .child(voice_line(bar.bands.as_ref(), bar.voice, t)),
130+ )
92 .child(131 .child(
93 div()132 div()
94 .id("bar_ping")133 .id("bar_ping")
crates/client/src/gui/camera_view.rsmodified+14 -5
@@ -10,11 +10,16 @@ use gpui_kit::{
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,
14+ media_view::into_render_image,
15+ notify_error,
16+ parts::{Voice, caption, voice_line},
14 share_view,17 share_view,
15 style::{radius, size, space, text},18 style::{radius, size, space, text},
16- parts::{Voice, caption, voice_line},19+ surface::Surface,
17- surface::Surface, text, wave::mini_wave, widget::spawn_warn,20+ text,
21+ wave::mini_wave,
22+ widget::spawn_warn,
18 };23 };
19 use crate::share::session::WatchQuality;24 use crate::share::session::WatchQuality;
20 25
@@ -258,8 +263,12 @@ impl Yumush {
258 } else {263 } else {
259 Voice::Quiet264 Voice::Quiet
260 };265 };
261- caption(user.username.clone(), voice_line(self.chat.waves.voice(user.id), voice, t), t)266+ caption(
262- .w(px(size::TALK))267+ user.username.clone(),
268+ voice_line(self.chat.waves.voice(user.id), voice, t),
269+ t,
270+ )
271+ .w(px(size::TALK))
263 });272 });
264 div()273 div()
265 .flex()274 .flex()
crates/client/src/gui/chat.rsmodified+202 -183
@@ -160,6 +160,7 @@ pub struct Chat {
160 pub(super) jump: Option<Id>,160 pub(super) jump: Option<Id>,
161 highlight: Option<(Id, Instant)>,161 highlight: Option<(Id, Instant)>,
162 pub(super) view: View,162 pub(super) view: View,
163+ pub(super) section: usize,
163 pub(super) username_input: Entity<InputState>,164 pub(super) username_input: Entity<InputState>,
164 pub(super) community_name_input: Entity<InputState>,165 pub(super) community_name_input: Entity<InputState>,
165 pub(super) status_input: Entity<InputState>,166 pub(super) status_input: Entity<InputState>,
@@ -391,6 +392,7 @@ impl Chat {
391 tab: SidebarTab::Communities,392 tab: SidebarTab::Communities,
392 sidebar_collapsed: false,393 sidebar_collapsed: false,
393 view: View::Chat,394 view: View::Chat,
395+ section: 0,
394 username_input: editable_input("Username...", Yumush::save_username, window, cx),396 username_input: editable_input("Username...", Yumush::save_username, window, cx),
395 community_name_input: editable_input(397 community_name_input: editable_input(
396 "Community name...",398 "Community name...",
@@ -1309,7 +1311,13 @@ impl Yumush {
1309 .flex()1311 .flex()
1310 .flex_row()1312 .flex_row()
1311 .size_full()1313 .size_full()
1312- .child(self.sidebar(&entity, &search_text(&self.chat.search_input, cx), palette))1314+ .when(self.chat.view == View::Chat, |page| {
1315+ page.child(self.sidebar(
1316+ &entity,
1317+ &search_text(&self.chat.search_input, cx),
1318+ palette,
1319+ ))
1320+ })
1313 .child(self.main_panel(&entity, palette, cx))1321 .child(self.main_panel(&entity, palette, cx))
1314 .children(self.fullscreen_viewer(&entity, palette))1322 .children(self.fullscreen_viewer(&entity, palette))
1315 }1323 }
@@ -1403,7 +1411,12 @@ impl Yumush {
1403 .flex()1411 .flex()
1404 .items_center()1412 .items_center()
1405 .gap(px(space::SM))1413 .gap(px(space::SM))
1406- .child(super::parts::words(name.to_string(), super::parts::Text::Title, super::parts::Ink::Paper, palette.tokens))1414+ .child(super::parts::words(
1415+ name.to_string(),
1416+ super::parts::Text::Title,
1417+ super::parts::Ink::Paper,
1418+ palette.tokens,
1419+ ))
1407 .child(div().flex_1())1420 .child(div().flex_1())
1408 .children(1421 .children(
1409 community1422 community
@@ -1621,51 +1634,54 @@ impl Yumush {
1621 .border_t_1()1634 .border_t_1()
1622 .border_color(palette.border),1635 .border_color(palette.border),
1623 )1636 )
1624- .children(pending)1637+ .children(pending)
1625- .children(bar)1638+ .children(bar)
1626- .children(self.chat.typing_label().map(|label| {1639+ .children(self.chat.typing_label().map(|label| {
1627- div()1640+ div()
1628- .pl(px(space::XS))1641+ .pl(px(space::XS))
1629- .pb(px(space::XS))1642+ .pb(px(space::XS))
1630- .text_size(text(text::CAPTION))1643+ .text_size(text(text::CAPTION))
1631- .text_color(palette.muted)1644+ .text_color(palette.muted)
1632- .child(label)1645+ .child(label)
1633- }))1646+ }))
1634- .child(1647+ .child(
1635- div()1648+ div()
1636- .min_h(px(size::ROW))1649+ .min_h(px(size::ROW))
1637- .pl(px(space::XS))1650+ .pl(px(space::XS))
1638- .pr(px(space::XS))1651+ .pr(px(space::XS))
1639- .py(px(space::XS))1652+ .py(px(space::XS))
1653+ .flex()
1654+ .items_center()
1655+ .gap(px(space::SM))
1656+ .child(composer::plus_popover(&self.chat, &entity, palette))
1657+ .child(composer::format_popover(palette))
1658+ .child(
1659+ Textarea::new(&self.chat.message_input)
1660+ .appearance(false)
1661+ .text_size(text(text::BODY))
1662+ .text_color(palette.text)
1663+ .flex_1()
1664+ .min_w_0(),
1665+ )
1666+ .child(voice_note::mic_button(&entity, palette))
1667+ .child(
1668+ clickable("send_button", palette, move |window, cx| {
1669+ entity.update(cx, |yumush, cx| yumush.submit_composer(&input, window, cx))
1670+ })
1671+ .tip("Send")
1672+ .size(px(size::CONTROL_SM))
1640 .flex()1673 .flex()
1641 .items_center()1674 .items_center()
1642- .gap(px(space::SM))1675+ .justify_center()
1643- .child(composer::plus_popover(&self.chat, &entity, palette))1676+ .text_color(if has_text {
1644- .child(composer::format_popover(palette))1677+ palette.text
1645- .child(1678+ } else {
1646- Textarea::new(&self.chat.message_input)1679+ palette.muted
1647- .appearance(false)1680+ })
1648- .text_size(text(text::BODY))1681+ .child(Icon::new(IconName::ArrowUp).size(px(size::ICON_SM))),
1649- .text_color(palette.text)1682+ ),
1650- .flex_1()1683+ )
1651- .min_w_0(),1684+ .into_any_element()
1652- )
1653- .child(voice_note::mic_button(&entity, palette))
1654- .child(
1655- clickable("send_button", palette, move |window, cx| {
1656- entity
1657- .update(cx, |yumush, cx| yumush.submit_composer(&input, window, cx))
1658- })
1659- .tip("Send")
1660- .size(px(size::CONTROL_SM))
1661- .flex()
1662- .items_center()
1663- .justify_center()
1664- .text_color(if has_text { palette.text } else { palette.muted })
1665- .child(Icon::new(IconName::ArrowUp).size(px(size::ICON_SM))),
1666- ),
1667- )
1668- .into_any_element()
1669 }1685 }
1670 1686
1671 pub(super) fn select_community(1687 pub(super) fn select_community(
@@ -2400,7 +2416,11 @@ impl Yumush {
2400 (false, true) => (IconName::Headphones, "Leave voice"),2416 (false, true) => (IconName::Headphones, "Leave voice"),
2401 };2417 };
2402 let id = format!("voice_button_{direct}_{in_voice}");2418 let id = format!("voice_button_{direct}_{in_voice}");
2403- let color = if in_voice { palette.danger } else { palette.muted };2419+ let color = if in_voice {
2420+ palette.danger
2421+ } else {
2422+ palette.muted
2423+ };
2404 2424
2405 Some(2425 Some(
2406 clickable(id, palette, on_click)2426 clickable(id, palette, on_click)
@@ -2677,7 +2697,13 @@ fn members_popover(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -
2677 .gap(px(space::SM))2697 .gap(px(space::SM))
2678 .rounded(px(radius::MD))2698 .rounded(px(radius::MD))
2679 .child(presence_avatar(2699 .child(presence_avatar(
2680- avatar(palette, user, px(size::ICON), text(text::CAPTION), &avatars),2700+ avatar(
2701+ palette,
2702+ user,
2703+ px(size::ICON),
2704+ text(text::CAPTION),
2705+ &avatars,
2706+ ),
2681 *presence,2707 *presence,
2682 px(size::ICON),2708 px(size::ICON),
2683 palette,2709 palette,
@@ -2847,20 +2873,16 @@ fn render_message(
2847 }2873 }
2848 let author = chat.author(message.user_id);2874 let author = chat.author(message.user_id);
2849 let username = author.map_or("unknown", |user| user.username.as_str());2875 let username = author.map_or("unknown", |user| user.username.as_str());
2850- let name = div()2876+ let name = div().flex().items_center().gap(px(space::SM)).child(
2851- .flex()2877+ div()
2852- .items_center()2878+ .id(format!("author_name_{}", message.id))
2853- .gap(px(space::SM))2879+ .font_weight(FontWeight::SEMIBOLD)
2854- .child(2880+ .text_color(palette.text)
2855- div()2881+ .when(author.is_some(), |this| {
2856- .id(format!("author_name_{}", message.id))2882+ this.hover(|style| style.underline())
2857- .font_weight(FontWeight::SEMIBOLD)2883+ })
2858- .text_color(palette.text)2884+ .child(username.to_string()),
2859- .when(author.is_some(), |this| {2885+ );
2860- this.hover(|style| style.underline())
2861- })
2862- .child(username.to_string()),
2863- );
2864 let mentioned = me.is_some_and(|me| mentions(&message.body, &me.username));2886 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);2887 let mine = me.is_some_and(|me| me.id == message.user_id);
2866 let group = format!("message_{}", message.id);2888 let group = format!("message_{}", message.id);
@@ -2871,140 +2893,137 @@ fn render_message(
2871 .as_ref()2893 .as_ref()
2872 .is_some_and(|(id, at)| id == &message.id && at.elapsed() < HIGHLIGHT_TTL);2894 .is_some_and(|(id, at)| id == &message.id && at.elapsed() < HIGHLIGHT_TTL);
2873 2895
2874- let row = div()2896+ let row =
2875- .id(format!("message_row_{}", message.id))2897+ div()
2876- .group(group.clone())2898+ .id(format!("message_row_{}", message.id))
2877- .relative()2899+ .group(group.clone())
2878- .flex()2900+ .relative()
2879- .flex_col()2901+ .flex()
2880- .min_w_0()2902+ .flex_col()
2881- .hover(|style| style.bg(palette.hover))2903+ .min_w_0()
2882- .when(first && spaced && !selecting, |this| this.mt(px(space::LG)))2904+ .hover(|style| style.bg(palette.hover))
2883- .when(highlighted, |this| this.bg(palette.tokens.press()))2905+ .when(first && spaced && !selecting, |this| this.mt(px(space::LG)))
2884- .when(mentioned, |this| {2906+ .when(highlighted, |this| this.bg(palette.tokens.press()))
2885- this.border_l_2()2907+ .when(mentioned, |this| {
2886- .border_color(palette.accent)2908+ this.border_l_2().border_color(palette.accent)
2887- })2909+ })
2888- .when(first, |this| {2910+ .when(first, |this| {
2889- let author = match author {2911+ let author = match author {
2890- Some(user) => profile_popover(2912+ Some(user) => profile_popover(
2891- format!("author_{}", message.id),2913+ format!("author_{}", message.id),
2892- Anchor::TopLeft,2914+ Anchor::TopLeft,
2893- user,2915+ user,
2894- entity,2916+ entity,
2895- name.cursor_pointer(),2917+ name.cursor_pointer(),
2896- )2918+ )
2897- .into_any_element(),2919+ .into_any_element(),
2898- None => name.into_any_element(),2920+ None => name.into_any_element(),
2899- };2921+ };
2900 2922
2901- this.child(2923+ this.child(
2924+ div()
2925+ .relative()
2926+ .flex()
2927+ .items_center()
2928+ .gap(px(space::SM))
2929+ .mb(px(space::XXS))
2930+ .child(thread_dot(mine, palette))
2931+ .child(author)
2932+ .child(
2933+ div()
2934+ .text_size(text(text::CAPTION))
2935+ .text_color(palette.muted)
2936+ .child(millis_time(message.created_at, CLOCK)),
2937+ ),
2938+ )
2939+ })
2940+ .child(
2902 div()2941 div()
2903 .relative()2942 .relative()
2943+ .min_w_0()
2904 .flex()2944 .flex()
2905 .items_center()2945 .items_center()
2906 .gap(px(space::SM))2946 .gap(px(space::SM))
2907- .mb(px(space::XXS))
2908- .child(thread_dot(mine, palette))
2909- .child(author)
2910 .child(2947 .child(
2911 div()2948 div()
2912- .text_size(text(text::CAPTION))2949+ .min_w_0()
2913- .text_color(palette.muted)2950+ .max_w(px(size::PAGE))
2914- .child(millis_time(message.created_at, CLOCK)),2951+ .when(message.body.contains("```"), |this| this.w_full())
2915- ),2952+ .flex()
2916- )2953+ .flex_col()
2917- })2954+ .gap(px(space::SM))
2918- .child(2955+ .children(message_actions::quote_line(message, chat, palette))
2919- div()2956+ .when(!message.body.is_empty(), |this| {
2920- .relative()2957+ this.child(
2921- .min_w_0()2958+ div()
2922- .flex()2959+ .min_w_0()
2923- .items_center()2960+ .when(message.body.contains("```"), |this| this.w_full())
2924- .gap(px(space::SM))2961+ .flex()
2925- .child(2962+ .flex_wrap()
2926- div()2963+ .items_baseline()
2927- .min_w_0()2964+ .gap(px(space::XS))
2928- .max_w(px(size::PAGE))2965+ .text_size(text(text::BODY))
2929- .when(message.body.contains("```"), |this| this.w_full())2966+ .line_height(relative(1.55))
2930- .flex()2967+ .text_color(palette.body)
2931- .flex_col()2968+ .child(
2932- .gap(px(space::SM))
2933- .children(message_actions::quote_line(message, chat, palette))
2934- .when(!message.body.is_empty(), |this| {
2935- this.child(
2936- div()
2937- .min_w_0()
2938- .when(message.body.contains("```"), |this| this.w_full())
2939- .flex()
2940- .flex_wrap()
2941- .items_baseline()
2942- .gap(px(space::XS))
2943- .text_size(text(text::BODY))
2944- .line_height(relative(1.55))
2945- .text_color(palette.body)
2946- .child(
2947- div()
2948- .min_w_0()
2949- .when(message.body.contains("```"), |this| {
2950- this.w_full()
2951- })
2952- .child(
2953- TextView::markdown(
2954- format!("message-body-{}", message.id),
2955- hard_breaks(&message.body),
2956- )
2957- .selectable(true),
2958- ),
2959- )
2960- .when(message.edited, |this| {
2961- this.child(
2962 div()2969 div()
2963- .text_size(text(text::CAPTION))2970+ .min_w_0()
2964- .text_color(palette.muted)2971+ .when(message.body.contains("```"), |this| {
2965- .child("(edited)"),2972+ this.w_full()
2973+ })
2974+ .child(
2975+ TextView::markdown(
2976+ format!("message-body-{}", message.id),
2977+ hard_breaks(&message.body),
2978+ )
2979+ .selectable(true),
2980+ ),
2966 )2981 )
2967- }),2982+ .when(message.edited, |this| {
2968- )2983+ this.child(
2969- })2984+ div()
2970- .children(media_view::attachments(2985+ .text_size(text(text::CAPTION))
2971- &message.attachments,2986+ .text_color(palette.muted)
2972- &chat.media,2987+ .child("(edited)"),
2973- entity,2988+ )
2974- palette,2989+ }),
2975- ))2990+ )
2976- .children(snippet::snippet_card(message, chat, entity, palette))2991+ })
2977- .children(message.poll.as_ref().map(|poll| {2992+ .children(media_view::attachments(
2978- poll::poll_card(2993+ &message.attachments,
2979- poll,2994+ &chat.media,
2980- poll::PollMode::Live(message),
2981- me,
2982- chat,
2983 entity,2995 entity,
2984 palette,2996 palette,
2985- )2997+ ))
2986- }))2998+ .children(snippet::snippet_card(message, chat, entity, palette))
2987- .children(media_view::embeds(message, &chat.media, palette))2999+ .children(message.poll.as_ref().map(|poll| {
2988- .children(3000+ poll::poll_card(
2989- (!message.reactions.is_empty())3001+ poll,
2990- .then(|| message_actions::reactions(message, me, entity, palette)),3002+ poll::PollMode::Live(message),
2991- ),3003+ me,
2992- )3004+ chat,
2993- .children(message.pinned.then(|| message_actions::pin_mark(palette)))3005+ entity,
2994- .children((!selecting).then(|| {3006+ palette,
2995- div()3007+ )
2996- .absolute()3008+ }))
2997- .right_0()3009+ .children(media_view::embeds(message, &chat.media, palette))
2998- .top(px(-space::LG))3010+ .children(
2999- .child(message_actions::actions(3011+ (!message.reactions.is_empty()).then(|| {
3000- message, chat, me, entity, palette, group,3012+ message_actions::reactions(message, me, entity, palette)
3001- ))3013+ }),
3002- })),3014+ ),
3003- )3015+ )
3004- .children(3016+ .children(message.pinned.then(|| message_actions::pin_mark(palette)))
3005- (chat.report == Some(ReportTarget::Message(message.id)))3017+ .children((!selecting).then(|| {
3006- .then(|| message_actions::report_bar(&chat.report_reason, entity, palette)),3018+ div().absolute().right_0().top(px(-space::LG)).child(
3007- );3019+ message_actions::actions(message, chat, me, entity, palette, group),
3020+ )
3021+ })),
3022+ )
3023+ .children(
3024+ (chat.report == Some(ReportTarget::Message(message.id)))
3025+ .then(|| message_actions::report_bar(&chat.report_reason, entity, palette)),
3026+ );
3008 3027
3009 if !selecting {3028 if !selecting {
3010 return row.into_any_element();3029 return row.into_any_element();
crates/client/src/gui/community_settings.rsmodified+60 -43
@@ -29,8 +29,8 @@ use super::{
29 clickable, community_icon, entity_action, millis_time, notify_error,29 clickable, community_icon, entity_action, millis_time, notify_error,
30 profile::user_link,30 profile::user_link,
31 settings_page::{31 settings_page::{
32- Editable, Picture, danger_section, delete_control, page, picked_avatar, picture_card, row,32+ Editable, Picture, Section, danger_section, delete_control, page, picked_avatar,
33- section, small_button, text_row,33+ picture_card, row, section, small_button, text_row,
34 },34 },
35 style::{radius, size, space, text as text_token},35 style::{radius, size, space, text as text_token},
36 text,36 text,
@@ -91,7 +91,8 @@ impl Yumush {
91 let mut sections = Vec::new();91 let mut sections = Vec::new();
92 92
93 if let Some(community) = community.filter(|_| permission::can_rename_community(actor)) {93 if let Some(community) = community.filter(|_| permission::can_rename_community(actor)) {
94- sections.push(94+ sections.push(Section(
95+ "Profile",
95 picture_card(96 picture_card(
96 Picture {97 Picture {
97 id: "community_picture_picker",98 id: "community_picture_picker",
@@ -112,41 +113,35 @@ impl Yumush {
112 palette,113 palette,
113 )114 )
114 .into_any_element(),115 .into_any_element(),
115- );116+ ));
116 }117 }
117 if permission::can_rename_community(actor) {118 if permission::can_rename_community(actor) {
118- sections.push(119+ sections.push(section(
119- section(120+ "General",
120- "General",121+ palette,
122+ vec![text_row(
123+ Editable {
124+ id: "save_community_name_button",
125+ label: "Name",
126+ input: &self.chat.community_name_input,
127+ current: &name,
128+ save: Yumush::save_community_name,
129+ },
130+ entity,
121 palette,131 palette,
122- vec![text_row(132+ cx,
123- Editable {133+ )],
124- id: "save_community_name_button",134+ ));
125- label: "Name",
126- input: &self.chat.community_name_input,
127- current: &name,
128- save: Yumush::save_community_name,
129- },
130- entity,
131- palette,
132- cx,
133- )],
134- )
135- .into_any_element(),
136- );
137 }135 }
138 if let Some(community) = community.filter(|_| permission::can_manage_voice(actor)) {136 if let Some(community) = community.filter(|_| permission::can_manage_voice(actor)) {
139- sections.push(137+ sections.push(section(
140- section(138+ "Voice",
139+ palette,
140+ vec![row(
141 "Voice",141 "Voice",
142- palette,142+ voice_control(entity, community.id, community.voice_enabled, palette),
143- vec![row(143+ )],
144- "Voice",144+ ));
145- voice_control(entity, community.id, community.voice_enabled, palette),
146- )],
147- )
148- .into_any_element(),
149- );
150 }145 }
151 let mut moderation = Vec::new();146 let mut moderation = Vec::new();
152 if permission::can_unban(actor) {147 if permission::can_unban(actor) {
@@ -177,7 +172,7 @@ impl Yumush {
177 ));172 ));
178 }173 }
179 if !moderation.is_empty() {174 if !moderation.is_empty() {
180- sections.push(section("Moderation", palette, moderation).into_any_element());175+ sections.push(section("Moderation", palette, moderation));
181 }176 }
182 let mut danger = Vec::new();177 let mut danger = Vec::new();
183 if let Some(community) = community.filter(|_| permission::can_leave(actor)) {178 if let Some(community) = community.filter(|_| permission::can_leave(actor)) {
@@ -199,10 +194,17 @@ impl Yumush {
199 ));194 ));
200 }195 }
201 if !danger.is_empty() {196 if !danger.is_empty() {
202- sections.push(danger_section(palette, danger).into_any_element());197+ sections.push(danger_section(palette, danger));
203 }198 }
204 199
205- page("community_settings_scroll", entity, palette, name, sections)200+ page(
201+ "community_settings_scroll",
202+ entity,
203+ palette,
204+ name,
205+ sections,
206+ self.chat.section,
207+ )
206 }208 }
207 209
208 fn set_community_voice(210 fn set_community_voice(
@@ -554,7 +556,13 @@ fn moderation_body(
554 .gap(px(space::MD))556 .gap(px(space::MD))
555 .child(Input::new(search))557 .child(Input::new(search))
556 .child(sort)558 .child(sort)
557- .child(div().id(id).max_h(px(size::SHEET)).overflow_y_scroll().child(list))559+ .child(
560+ div()
561+ .id(id)
562+ .max_h(px(size::SHEET))
563+ .overflow_y_scroll()
564+ .child(list),
565+ )
558 }566 }
559 567
560 fn ban_list<'a>(bans: &'a [Ban], query: &str, sort: BanSort) -> Vec<&'a Ban> {568 fn ban_list<'a>(bans: &'a [Ban], query: &str, sort: BanSort) -> Vec<&'a Ban> {
@@ -623,12 +631,15 @@ fn log_row(entry: &LogEntry, palette: Palette, avatars: &HashMap<Id, Arc<Image>>
623 .flex()631 .flex()
624 .items_center()632 .items_center()
625 .gap(px(space::SM))633 .gap(px(space::SM))
626- .children(634+ .children(entry.actor.as_ref().map(|actor| {
627- entry635+ avatar(
628- .actor636+ palette,
629- .as_ref()637+ actor,
630- .map(|actor| avatar(palette, actor, px(size::AVATAR), text(text_token::CAPTION), avatars)),638+ px(size::AVATAR),
631- )639+ text(text_token::CAPTION),
640+ avatars,
641+ )
642+ }))
632 .child(div().flex_1().min_w_0().truncate().child(log_text(entry)))643 .child(div().flex_1().min_w_0().truncate().child(log_text(entry)))
633 .child(644 .child(
634 div()645 div()
@@ -677,7 +688,13 @@ fn ban_row(
677 format!("ban_avatar_{user_id}"),688 format!("ban_avatar_{user_id}"),
678 Some(user),689 Some(user),
679 &entity,690 &entity,
680- avatar(palette, user, px(size::AVATAR), text(text_token::CAPTION), avatars),691+ avatar(
692+ palette,
693+ user,
694+ px(size::AVATAR),
695+ text(text_token::CAPTION),
696+ avatars,
697+ ),
681 ))698 ))
682 .child(699 .child(
683 div()700 div()
crates/client/src/gui/composer.rsmodified+6 -1
@@ -564,7 +564,12 @@ pub fn format_popover(palette: Palette) -> impl IntoElement {
564 .flex()564 .flex()
565 .items_center()565 .items_center()
566 .gap(px(space::MD))566 .gap(px(space::MD))
567- .child(div().w(px(size::THUMB)).text_color(palette.muted).child(syntax))567+ .child(
568+ div()
569+ .w(px(size::THUMB))
570+ .text_color(palette.muted)
571+ .child(syntax),
572+ )
568 .child(div().flex_1().child(TextView::markdown(syntax, syntax)))573 .child(div().flex_1().child(TextView::markdown(syntax, syntax)))
569 .child(574 .child(
570 div()575 div()
crates/client/src/gui/forward.rsmodified+10 -2
@@ -86,7 +86,12 @@ impl Render for Forward {
86 .items_center()86 .items_center()
87 .gap(px(space::SM))87 .gap(px(space::SM))
88 .rounded(px(radius::MD))88 .rounded(px(radius::MD))
89- .child(yumush.community_badge(community, px(size::ICON), super::text(text::CAPTION), palette))89+ .child(yumush.community_badge(
90+ community,
91+ px(size::ICON),
92+ super::text(text::CAPTION),
93+ palette,
94+ ))
90 .child(95 .child(
91 div()96 div()
92 .flex_1()97 .flex_1()
@@ -141,7 +146,10 @@ impl Yumush {
141 let forward = cx.new(|cx| Forward::new(yumush, selected, window, cx));146 let forward = cx.new(|cx| Forward::new(yumush, selected, window, cx));
142 147
143 window.open_dialog(cx, move |dialog, _, _| {148 window.open_dialog(cx, move |dialog, _, _| {
144- dialog.title("Forward").w(px(size::SHEET)).child(forward.clone())149+ dialog
150+ .title("Forward")
151+ .w(px(size::SHEET))
152+ .child(forward.clone())
145 });153 });
146 }154 }
147 155
crates/client/src/gui/gallery.rsmodified+138 -23
@@ -5,6 +5,7 @@ use gpui_kit::{
5 Context, IntoElement, ParentElement, Render, Styled, Window, assets::IconName, div, px,5 Context, IntoElement, ParentElement, Render, Styled, Window, assets::IconName, div, px,
6 };6 };
7 7
8+use super::call_bar::{self, CallActions, CallBar};
8 use super::{9 use super::{
9 parts::{10 parts::{
10 Fill, Ink, Press, Text, Tone, Voice, band, button, caption, chevron, column, grow,11 Fill, Ink, Press, Text, Tone, Voice, band, button, caption, chevron, column, grow,
@@ -14,7 +15,6 @@ use super::{
14 style::{Theme, Tokens, size, space},15 style::{Theme, Tokens, size, space},
15 };16 };
16 use crate::settings::FontSize;17 use crate::settings::FontSize;
17-use super::call_bar::{self, CallActions, CallBar};
18 use std::rc::Rc;18 use std::rc::Rc;
19 19
20 #[derive(Debug, Clone, Copy, PartialEq, Eq)]20 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -97,7 +97,8 @@ impl Render for Gallery {
97 let page = match self.page.as_str() {97 let page = match self.page.as_str() {
98 "parts" => parts_page(self.state, t).into_any_element(),98 "parts" => parts_page(self.state, t).into_any_element(),
99 "call" => call_page(self.state, t).into_any_element(),99 "call" => call_page(self.state, t).into_any_element(),
100- other => words(format!("no gallery page {other}"), Text::Body, Ink::Bad, t).into_any_element(),100+ other => words(format!("no gallery page {other}"), Text::Body, Ink::Bad, t)
101+ .into_any_element(),
101 };102 };
102 div()103 div()
103 .size_full()104 .size_full()
@@ -132,44 +133,139 @@ fn parts_page(state: State, t: Tokens) -> impl IntoElement {
132 };133 };
133 let lines = stack(space::SM)134 let lines = stack(space::SM)
134 .child(section("Lines", t))135 .child(section("Lines", t))
135- .child(caption(name(state, "alice"), voice_line(Some(&live), voice, t), t))136+ .child(caption(
136- .child(caption(name(state, "bob"), voice_line(None, Voice::Quiet, t), t))137+ name(state, "alice"),
137- .child(caption("carol", voice_line(Some(&bands(3.)), Voice::Live(t.hue(Hue::Violet)), t), t))138+ voice_line(Some(&live), voice, t),
139+ t,
140+ ))
141+ .child(caption(
142+ name(state, "bob"),
143+ voice_line(None, Voice::Quiet, t),
144+ t,
145+ ))
146+ .child(caption(
147+ "carol",
148+ voice_line(Some(&bands(3.)), Voice::Live(t.hue(Hue::Violet)), t),
149+ t,
150+ ))
138 .child(151 .child(
139 band(space::MD)152 band(space::MD)
140 .h(px(size::ROW))153 .h(px(size::ROW))
141 .child(words("ping", Text::Caption, Ink::Dim, t))154 .child(words("ping", Text::Caption, Ink::Dim, t))
142- .child(div().flex_1().h_full().child(spark(155+ .child(
143- (0..40).map(|index| (index as f32 * 0.5).sin() * 0.3 + 0.5).collect(),156+ div().flex_1().h_full().child(spark(
144- 40,157+ (0..40)
145- if state == State::Bad { t.bad() } else { t.paper() },158+ .map(|index| (index as f32 * 0.5).sin() * 0.3 + 0.5)
146- )))159+ .collect(),
147- .child(strong(if state == State::Bad { "212 ms" } else { "24 ms" }, Text::Ui, t)),160+ 40,
161+ if state == State::Bad {
162+ t.bad()
163+ } else {
164+ t.paper()
165+ },
166+ )),
167+ )
168+ .child(strong(
169+ if state == State::Bad {
170+ "212 ms"
171+ } else {
172+ "24 ms"
173+ },
174+ Text::Ui,
175+ t,
176+ )),
148 );177 );
149 let rows = column()178 let rows = column()
150 .child(section("Rows", t))179 .child(section("Rows", t))
151- .child(row(name(state, "Noise suppression"), toggle("g_toggle", true, t, |_, _| {}), t))180+ .child(row(
181+ name(state, "Noise suppression"),
182+ toggle("g_toggle", true, t, |_, _| {}),
183+ t,
184+ ))
152 .child(row("Mute", toggle("g_toggle_off", false, t, |_, _| {}), t))185 .child(row("Mute", toggle("g_toggle_off", false, t, |_, _| {}), t))
153 .child(row(186 .child(row(
154 "Mode",187 "Mode",
155- options("g_mode", [(0, "Voice activity"), (1, "Push to talk")], 0, t, |_, _, _| {}),188+ options(
189+ "g_mode",
190+ [(0, "Voice activity"), (1, "Push to talk")],
191+ 0,
192+ t,
193+ |_, _, _| {},
194+ ),
195+ t,
196+ ))
197+ .child(row(
198+ "CPU",
199+ band(space::MD)
200+ .w(px(size::POPOVER))
201+ .child(track(
202+ Fill::Over {
203+ own: 0.09,
204+ total: 0.31,
205+ },
206+ false,
207+ t,
208+ ))
209+ .child(words("9 / 31 %", Text::Label, Ink::Paper, t)),
156 t,210 t,
157 ))211 ))
158- .child(row("CPU", band(space::MD).w(px(size::POPOVER)).child(track(Fill::Over { own: 0.09, total: 0.31 }, false, t)).child(words("9 / 31 %", Text::Label, Ink::Paper, t)), t))212+ .child(row(
159- .child(row("Loss", band(space::MD).w(px(size::POPOVER)).child(track(Fill::Part(0.42), state == State::Bad, t)).child(words("4.2 %", Text::Label, if state == State::Bad { Ink::Bad } else { Ink::Paper }, t)), t));213+ "Loss",
214+ band(space::MD)
215+ .w(px(size::POPOVER))
216+ .child(track(Fill::Part(0.42), state == State::Bad, t))
217+ .child(words(
218+ "4.2 %",
219+ Text::Label,
220+ if state == State::Bad {
221+ Ink::Bad
222+ } else {
223+ Ink::Paper
224+ },
225+ t,
226+ )),
227+ t,
228+ ));
160 let controls = stack(space::MD)229 let controls = stack(space::MD)
161 .child(section("Controls", t))230 .child(section("Controls", t))
162 .child(231 .child(
163 band(space::XS)232 band(space::XS)
164- .child(icon_button("g_mic", IconName::Mic, "Mute", Tone::Idle, t, |_, _| {}))233+ .child(icon_button(
234+ "g_mic",
235+ IconName::Mic,
236+ "Mute",
237+ Tone::Idle,
238+ t,
239+ |_, _| {},
240+ ))
165 .child(chevron("g_mic_more", false, t, |_, _| {}))241 .child(chevron("g_mic_more", false, t, |_, _| {}))
166- .child(icon_button("g_cam", IconName::Camera, "Camera", Tone::On, t, |_, _| {}))242+ .child(icon_button(
243+ "g_cam",
244+ IconName::Camera,
245+ "Camera",
246+ Tone::On,
247+ t,
248+ |_, _| {},
249+ ))
167 .child(chevron("g_cam_more", true, t, |_, _| {}))250 .child(chevron("g_cam_more", true, t, |_, _| {}))
168- .child(icon_button("g_leave", IconName::PhoneOff, "Leave", Tone::Danger, t, |_, _| {})),251+ .child(icon_button(
252+ "g_leave",
253+ IconName::PhoneOff,
254+ "Leave",
255+ Tone::Danger,
256+ t,
257+ |_, _| {},
258+ )),
169 )259 )
170 .child(260 .child(
171 band(space::XL)261 band(space::XL)
172- .child(button("g_plain", "Change source", Press::Plain, t, |_, _| {}))262+ .child(button(
263+ "g_plain",
264+ "Change source",
265+ Press::Plain,
266+ t,
267+ |_, _| {},
268+ ))
173 .child(button("g_stop", "Stop", Press::Danger, t, |_, _| {}))269 .child(button("g_stop", "Stop", Press::Danger, t, |_, _| {}))
174 .child(button("g_share", "Share", Press::Primary, t, |_, _| {})),270 .child(button("g_share", "Share", Press::Primary, t, |_, _| {})),
175 )271 )
@@ -178,7 +274,13 @@ fn parts_page(state: State, t: Tokens) -> impl IntoElement {
178 .w(px(size::SIDEBAR))274 .w(px(size::SIDEBAR))
179 .child(index_item("g_i1", "Profile", false, t, |_, _| {}))275 .child(index_item("g_i1", "Profile", false, t, |_, _| {}))
180 .child(index_item("g_i2", "Voice", true, t, |_, _| {}))276 .child(index_item("g_i2", "Voice", true, t, |_, _| {}))
181- .child(index_item("g_i3", name(state, "Camera & share"), false, t, |_, _| {})),277+ .child(index_item(
278+ "g_i3",
279+ name(state, "Camera & share"),
280+ false,
281+ t,
282+ |_, _| {},
283+ )),
182 );284 );
183 let pop = popover(t)285 let pop = popover(t)
184 .w(px(size::POPOVER))286 .w(px(size::POPOVER))
@@ -186,14 +288,27 @@ fn parts_page(state: State, t: Tokens) -> impl IntoElement {
186 .child(section("Microphone", t))288 .child(section("Microphone", t))
187 .child(words("Shure MV7", Text::Ui, Ink::Paper, t))289 .child(words("Shure MV7", Text::Ui, Ink::Paper, t))
188 .child(words("Laptop mic", Text::Ui, Ink::Dim, t))290 .child(words("Laptop mic", Text::Ui, Ink::Dim, t))
189- .child(div().h(px(size::ICON)).child(voice_line(Some(&live), voice, t)))291+ .child(
190- .child(row("Noise suppression", toggle("g_pop_toggle", true, t, |_, _| {}), t));292+ div()
293+ .h(px(size::ICON))
294+ .child(voice_line(Some(&live), voice, t)),
295+ )
296+ .child(row(
297+ "Noise suppression",
298+ toggle("g_pop_toggle", true, t, |_, _| {}),
299+ t,
300+ ));
191 band(space::XXL)301 band(space::XXL)
192 .items_start()302 .items_start()
193 .size_full()303 .size_full()
194 .p(px(space::XXL))304 .p(px(space::XXL))
195 .child(stack(space::XL).flex_1().child(lines).child(rows))305 .child(stack(space::XL).flex_1().child(lines).child(rows))
196- .child(stack(space::XL).w(px(size::TALK + size::CONTROL)).child(controls).child(pop))306+ .child(
307+ stack(space::XL)
308+ .w(px(size::TALK + size::CONTROL))
309+ .child(controls)
310+ .child(pop),
311+ )
197 .child(grow())312 .child(grow())
198 }313 }
199 314
crates/client/src/gui/message_actions.rsmodified+10 -3
@@ -165,7 +165,15 @@ pub fn quote_line(message: &Message, chat: &Chat, palette: Palette) -> Option<im
165 .border_color(palette.border)165 .border_color(palette.border)
166 .text_size(text(text::CAPTION))166 .text_size(text(text::CAPTION))
167 .text_color(palette.muted)167 .text_color(palette.muted)
168- .children(author.map(|user| avatar(palette, user, px(size::ICON_SM), text(text::CAPTION), &chat.avatars)))168+ .children(author.map(|user| {
169+ avatar(
170+ palette,
171+ user,
172+ px(size::ICON_SM),
173+ text(text::CAPTION),
174+ &chat.avatars,
175+ )
176+ }))
169 .children(author.map(|user| {177 .children(author.map(|user| {
170 div()178 div()
171 .flex_shrink_0()179 .flex_shrink_0()
@@ -448,8 +456,7 @@ pub fn actions(
448 |yumush, id, window, cx| yumush.request_message_delete(id, window, cx),456 |yumush, id, window, cx| yumush.request_message_delete(id, window, cx),
449 )457 )
450 .when(armed, |this| {458 .when(armed, |this| {
451- this.text_color(palette.danger)459+ this.text_color(palette.danger).bg(palette.tokens.press())
452- .bg(palette.tokens.press())
453 })460 })
454 }))461 }))
455 }462 }
crates/client/src/gui/parts.rsmodified+73 -16
@@ -1,10 +1,9 @@
1 use std::{collections::VecDeque, time::Duration};1 use std::{collections::VecDeque, time::Duration};
2 2
3 use gpui_kit::{3 use gpui_kit::{
4- prelude::FluentBuilder,
5 AnyElement, App, Div, ElementId, FontWeight, Hsla, InteractiveElement, IntoElement,4 AnyElement, App, Div, ElementId, FontWeight, Hsla, InteractiveElement, IntoElement,
6 ParentElement, PathBuilder, SharedString, Stateful, StatefulInteractiveElement, Styled, Window,5 ParentElement, PathBuilder, SharedString, Stateful, StatefulInteractiveElement, Styled, Window,
7- assets::IconName, canvas, component::Icon, div, point, px,6+ assets::IconName, canvas, component::Icon, div, point, prelude::FluentBuilder, px,
8 };7 };
9 8
10 use super::{9 use super::{
@@ -72,7 +71,11 @@ pub fn strong(content: impl Into<SharedString>, style: Text, t: Tokens) -> Div {
72 }71 }
73 72
74 pub fn thread(t: Tokens) -> Div {73 pub fn thread(t: Tokens) -> Div {
75- div().w_full().h(px(stroke::LINE)).flex_none().bg(t.thread())74+ div()
75+ .w_full()
76+ .h(px(stroke::LINE))
77+ .flex_none()
78+ .bg(t.thread())
76 }79 }
77 80
78 pub fn grow() -> Div {81 pub fn grow() -> Div {
@@ -96,7 +99,11 @@ pub fn row(label: impl Into<SharedString>, trailing: impl IntoElement, t: Tokens
96 band(space::XL)99 band(space::XL)
97 .min_h(px(size::ROW))100 .min_h(px(size::ROW))
98 .py(px(space::SM))101 .py(px(space::SM))
99- .child(words(label, Text::Ui, Ink::Paper, t).flex_shrink_0().max_w(gpui_kit::relative(0.5)))102+ .child(
103+ words(label, Text::Ui, Ink::Paper, t)
104+ .flex_shrink_0()
105+ .max_w(gpui_kit::relative(0.5)),
106+ )
100 .child(grow())107 .child(grow())
101 .child(trailing),108 .child(trailing),
102 )109 )
@@ -134,7 +141,12 @@ pub fn track(fill: Fill, bad: bool, t: Tokens) -> Div {
134 }141 }
135 }142 }
136 143
137-pub fn toggle(id: impl Into<ElementId>, on: bool, t: Tokens, flip: impl Fn(&mut Window, &mut App) + 'static) -> Stateful<Div> {144+pub fn toggle(
145+ id: impl Into<ElementId>,
146+ on: bool,
147+ t: Tokens,
148+ flip: impl Fn(&mut Window, &mut App) + 'static,
149+) -> Stateful<Div> {
138 let (bar, knob, left) = if on {150 let (bar, knob, left) = if on {
139 (t.hue(common::model::Hue::Amber), t.paper(), 20.)151 (t.hue(common::model::Hue::Amber), t.paper(), 20.)
140 } else {152 } else {
@@ -147,8 +159,24 @@ pub fn toggle(id: impl Into<ElementId>, on: bool, t: Tokens, flip: impl Fn(&mut
147 .w(px(30.))159 .w(px(30.))
148 .h(px(14.))160 .h(px(14.))
149 .on_click(move |_, window, cx| flip(window, cx))161 .on_click(move |_, window, cx| flip(window, cx))
150- .child(div().absolute().left_0().right_0().top(px(6.)).h(px(stroke::LINE)).bg(bar))162+ .child(
151- .child(div().absolute().top(px(2.)).left(px(left)).size(px(10.)).rounded_full().bg(knob))163+ div()
164+ .absolute()
165+ .left_0()
166+ .right_0()
167+ .top(px(6.))
168+ .h(px(stroke::LINE))
169+ .bg(bar),
170+ )
171+ .child(
172+ div()
173+ .absolute()
174+ .top(px(2.))
175+ .left(px(left))
176+ .size(px(10.))
177+ .rounded_full()
178+ .bg(knob),
179+ )
152 }180 }
153 181
154 pub fn options<T: Copy + PartialEq + 'static>(182 pub fn options<T: Copy + PartialEq + 'static>(
@@ -166,8 +194,15 @@ pub fn options<T: Copy + PartialEq + 'static>(
166 .id(ElementId::Name(format!("{id}_{label}").into()))194 .id(ElementId::Name(format!("{id}_{label}").into()))
167 .cursor_pointer()195 .cursor_pointer()
168 .on_click(move |_, window, cx| pick(item, window, cx))196 .on_click(move |_, window, cx| pick(item, window, cx))
169- .child(words(label, Text::Ui, if on { Ink::Paper } else { Ink::Dim }, t).font_weight(FontWeight::MEDIUM))197+ .child(
170- .child(div().h(px(stroke::LINE)).bg(if on { t.paper() } else { gpui_kit::transparent_black() }))198+ words(label, Text::Ui, if on { Ink::Paper } else { Ink::Dim }, t)
199+ .font_weight(FontWeight::MEDIUM),
200+ )
201+ .child(div().h(px(stroke::LINE)).bg(if on {
202+ t.paper()
203+ } else {
204+ gpui_kit::transparent_black()
205+ }))
171 }))206 }))
172 }207 }
173 208
@@ -192,15 +227,23 @@ pub fn button(
192 .on_click(move |_, window, cx| on_click(window, cx));227 .on_click(move |_, window, cx| on_click(window, cx));
193 let label = label.into();228 let label = label.into();
194 match kind {229 match kind {
195- Press::Plain => base.child(words(label, Text::Ui, Ink::Paper, t).font_weight(FontWeight::MEDIUM)),230+ Press::Plain => {
196- Press::Danger => base.child(words(label, Text::Ui, Ink::Bad, t).font_weight(FontWeight::MEDIUM)),231+ base.child(words(label, Text::Ui, Ink::Paper, t).font_weight(FontWeight::MEDIUM))
232+ }
233+ Press::Danger => {
234+ base.child(words(label, Text::Ui, Ink::Bad, t).font_weight(FontWeight::MEDIUM))
235+ }
197 Press::Primary => base236 Press::Primary => base
198 .px(px(space::LG + 2.))237 .px(px(space::LG + 2.))
199 .h(px(32.))238 .h(px(32.))
200 .rounded_full()239 .rounded_full()
201 .bg(t.paper())240 .bg(t.paper())
202 .hover(|style| style.opacity(0.9))241 .hover(|style| style.opacity(0.9))
203- .child(words(label, Text::Ui, Ink::Paper, t).font_weight(FontWeight::SEMIBOLD).text_color(t.ground())),242+ .child(
243+ words(label, Text::Ui, Ink::Paper, t)
244+ .font_weight(FontWeight::SEMIBOLD)
245+ .text_color(t.ground()),
246+ ),
204 }247 }
205 }248 }
206 249
@@ -292,7 +335,11 @@ pub fn index_item(
292 on_click: impl Fn(&mut Window, &mut App) + 'static,335 on_click: impl Fn(&mut Window, &mut App) + 'static,
293 ) -> Stateful<Div> {336 ) -> Stateful<Div> {
294 let ink = if selected { Ink::Paper } else { Ink::Dim };337 let ink = if selected { Ink::Paper } else { Ink::Dim };
295- let weight = if selected { FontWeight::MEDIUM } else { FontWeight::NORMAL };338+ let weight = if selected {
339+ FontWeight::MEDIUM
340+ } else {
341+ FontWeight::NORMAL
342+ };
296 band(space::MD)343 band(space::MD)
297 .id(id)344 .id(id)
298 .cursor_pointer()345 .cursor_pointer()
@@ -309,7 +356,9 @@ pub enum Voice {
309 }356 }
310 357
311 pub fn voice_line(bands: Option<&VecDeque<f32>>, voice: Voice, t: Tokens) -> AnyElement {358 pub fn voice_line(bands: Option<&VecDeque<f32>>, voice: Voice, t: Tokens) -> AnyElement {
312- let levels: Vec<f32> = bands.map(|bands| bands.iter().copied().collect()).unwrap_or_default();359+ let levels: Vec<f32> = bands
360+ .map(|bands| bands.iter().copied().collect())
361+ .unwrap_or_default();
313 let color = match voice {362 let color = match voice {
314 Voice::Quiet => t.off(),363 Voice::Quiet => t.off(),
315 Voice::Live(color) => color,364 Voice::Live(color) => color,
@@ -375,7 +424,11 @@ pub fn pop_in<E: IntoElement + Styled + 'static>(
375 element: E,424 element: E,
376 anchor: gpui_kit::Anchor,425 anchor: gpui_kit::Anchor,
377 ) -> gpui_kit::AnimationElement<E> {426 ) -> gpui_kit::AnimationElement<E> {
378- let travel = if anchor.is_bottom() { MOTION_TRAVEL } else { -MOTION_TRAVEL };427+ let travel = if anchor.is_bottom() {
428+ MOTION_TRAVEL
429+ } else {
430+ -MOTION_TRAVEL
431+ };
379 gpui_kit::AnimationExt::with_animation(element, id, motion(), move |element, delta| {432 gpui_kit::AnimationExt::with_animation(element, id, motion(), move |element, delta| {
380 element.top(px(travel * (1. - delta))).opacity(delta)433 element.top(px(travel * (1. - delta))).opacity(delta)
381 })434 })
@@ -386,7 +439,11 @@ pub fn swap_in<E: IntoElement + Styled + 'static>(
386 element: E,439 element: E,
387 forward: bool,440 forward: bool,
388 ) -> gpui_kit::AnimationElement<E> {441 ) -> gpui_kit::AnimationElement<E> {
389- let travel = if forward { MOTION_TRAVEL } else { -MOTION_TRAVEL };442+ let travel = if forward {
443+ MOTION_TRAVEL
444+ } else {
445+ -MOTION_TRAVEL
446+ };
390 gpui_kit::AnimationExt::with_animation(element, id, motion(), move |element, delta| {447 gpui_kit::AnimationExt::with_animation(element, id, motion(), move |element, delta| {
391 element.left(px(travel * (1. - delta))).opacity(delta)448 element.left(px(travel * (1. - delta))).opacity(delta)
392 })449 })
crates/client/src/gui/poll.rsmodified+19 -6
@@ -11,8 +11,9 @@ use gpui_kit::{
11 use super::{11 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,
15 style::{radius, size, space, text},15 style::{radius, size, space, text},
16+ text,
16 widget::{icon_button, panel, spawn_done},17 widget::{icon_button, panel, spawn_done},
17 };18 };
18 19
@@ -125,7 +126,13 @@ fn voters_popover(key: &str, poll: &Poll, entity: &Entity<Yumush>, palette: Pale
125 .items_center()126 .items_center()
126 .gap(px(space::SM))127 .gap(px(space::SM))
127 .text_size(text(text::CAPTION))128 .text_size(text(text::CAPTION))
128- .child(avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &chat.avatars))129+ .child(avatar(
130+ palette,
131+ user,
132+ px(size::AVATAR),
133+ text(text::CAPTION),
134+ &chat.avatars,
135+ ))
129 .child(136 .child(
130 div()137 div()
131 .flex_1()138 .flex_1()
@@ -285,10 +292,16 @@ pub fn poll_card(
285 .enumerate()292 .enumerate()
286 .filter_map(|(index, id)| {293 .filter_map(|(index, id)| {
287 chat.author(*id).map(|user| {294 chat.author(*id).map(|user| {
288- avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &chat.avatars)295+ avatar(
289- .border_2()296+ palette,
290- .border_color(palette.panel)297+ user,
291- .when(index > 0, |el| el.ml(px(-space::SM)))298+ px(size::AVATAR),
299+ text(text::CAPTION),
300+ &chat.avatars,
301+ )
302+ .border_2()
303+ .border_color(palette.panel)
304+ .when(index > 0, |el| el.ml(px(-space::SM)))
292 })305 })
293 }),306 }),
294 )307 )
crates/client/src/gui/profile.rsmodified+20 -4
@@ -23,12 +23,12 @@ use gpui_kit::{
23 use super::chat::{CardMenu, ReportTarget, View};23 use super::chat::{CardMenu, ReportTarget, View};
24 use super::message_actions::report_bar;24 use super::message_actions::report_bar;
25 use super::social::Relation;25 use super::social::Relation;
26+use super::style::{radius, size, space, stroke, text};
26 use super::widget::{panel, spawn_done};27 use super::widget::{panel, spawn_done};
27 use super::{28 use super::{
28 DAY_YEAR, Palette, Trigger, Yumush, avatar, clickable, entity_action, input_dialog,29 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,30 millis_time, notify_error, palette, pop_in, presence_color, rank_tag, swap_in, text,
30 };31 };
31-use super::style::{radius, size, space, stroke, text};
32 32
33 const ACCOUNTS_MAX_H: f32 = 180.;33 const ACCOUNTS_MAX_H: f32 = 180.;
34 34
@@ -223,7 +223,12 @@ impl Card {
223 rows.extend(self.moderation_rows(entity, &popover, palette));223 rows.extend(self.moderation_rows(entity, &popover, palette));
224 rows224 rows
225 };225 };
226- let divider = (!rows.is_empty()).then(|| div().h(px(stroke::LINE)).my(px(space::XS)).bg(palette.border));226+ let divider = (!rows.is_empty()).then(|| {
227+ div()
228+ .h(px(stroke::LINE))
229+ .my(px(space::XS))
230+ .bg(palette.border)
231+ });
227 232
228 panel(palette)233 panel(palette)
229 .w(px(size::SIDEBAR))234 .w(px(size::SIDEBAR))
@@ -231,7 +236,13 @@ impl Card {
231 .flex()236 .flex()
232 .flex_col()237 .flex_col()
233 .gap(px(space::MD))238 .gap(px(space::MD))
234- .child(avatar(palette, &self.user, px(size::AVATAR_LG), text(text::BODY), avatars))239+ .child(avatar(
240+ palette,
241+ &self.user,
242+ px(size::AVATAR_LG),
243+ text(text::BODY),
244+ avatars,
245+ ))
235 .child(246 .child(
236 div()247 div()
237 .flex()248 .flex()
@@ -279,7 +290,12 @@ impl Card {
279 .text_color(palette.muted)290 .text_color(palette.muted)
280 .child(Icon::new(IconName::Volume2).size(px(size::ICON_SM)))291 .child(Icon::new(IconName::Volume2).size(px(size::ICON_SM)))
281 .child(Slider::new(&slider).flex_1())292 .child(Slider::new(&slider).flex_1())
282- .child(div().w(px(size::CONTROL)).text_right().child(format!("{volume:.0}%")))293+ .child(
294+ div()
295+ .w(px(size::CONTROL))
296+ .text_right()
297+ .child(format!("{volume:.0}%")),
298+ )
283 }))299 }))
284 .children(300 .children(
285 self.reporting301 self.reporting
crates/client/src/gui/settings_page.rsmodified+188 -156
@@ -10,18 +10,15 @@ use gpui_kit::{
10 InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful,10 InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful,
11 StatefulInteractiveElement, Styled, WeakEntity, Window,11 StatefulInteractiveElement, Styled, WeakEntity, Window,
12 assets::IconName,12 assets::IconName,
13- component::input::InputState,13+ component::{Icon, input::InputState},
14 div,14 div,
15 prelude::FluentBuilder as _,15 prelude::FluentBuilder as _,
16 px, transparent_black,16 px, transparent_black,
17 };17 };
18 18
19 use super::{19 use super::{
20- Palette, Tooltip as _, Yumush, avatar,20+ Palette, Tooltip as _, Yumush, avatar, chat::DeleteStep, chat::View, clickable, notify_error,
21- chat::DeleteStep,21+ primary_button, text, widget::field,
22- chat::View,
23- clickable, notify_error, primary_button, text,
24- widget::{field, icon_button},
25 };22 };
26 use crate::{23 use crate::{
27 gui::style::{Theme, radius, size, space, stroke, text},24 gui::style::{Theme, radius, size, space, stroke, text},
@@ -37,11 +34,18 @@ impl Yumush {
37 ) -> impl IntoElement {34 ) -> impl IntoElement {
38 let mut sections = Vec::new();35 let mut sections = Vec::new();
39 if let Some(user) = self.user.as_ref() {36 if let Some(user) = self.user.as_ref() {
40- sections.push(37+ sections.push(Section(
38+ "Profile",
41 picture_card(39 picture_card(
42 Picture {40 Picture {
43 id: "avatar_picker",41 id: "avatar_picker",
44- image: avatar(palette, user, px(size::AVATAR_LG), text(text::TITLE), &self.chat.avatars),42+ image: avatar(
43+ palette,
44+ user,
45+ px(size::AVATAR_LG),
46+ text(text::TITLE),
47+ &self.chat.avatars,
48+ ),
45 title: user.username.clone(),49 title: user.username.clone(),
46 subtitle: user.status.clone(),50 subtitle: user.status.clone(),
47 removable: user.avatar_id.is_some(),51 removable: user.avatar_id.is_some(),
@@ -52,110 +56,110 @@ impl Yumush {
52 palette,56 palette,
53 )57 )
54 .into_any_element(),58 .into_any_element(),
55- );59+ ));
56- sections.push(60+ sections.push(section(
57- section(61+ "Account",
58- "Account",
59- palette,
60- vec![
61- text_row(
62- Editable {
63- id: "save_username_button",
64- label: "Username",
65- input: &self.chat.username_input,
66- current: &user.username,
67- save: Yumush::save_username,
68- },
69- entity,
70- palette,
71- cx,
72- ),
73- text_row(
74- Editable {
75- id: "save_status_button",
76- label: "Status",
77- input: &self.chat.status_input,
78- current: &user.status,
79- save: Yumush::save_status,
80- },
81- entity,
82- palette,
83- cx,
84- ),
85- ],
86- )
87- .into_any_element(),
88- );
89- }
90- sections.push(
91- section("Voice", palette, self.voice_rows(entity, palette, cx)).into_any_element(),
92- );
93- sections.push(
94- section(
95- "Appearance",
96 palette,62 palette,
97 vec![63 vec![
98- row(64+ text_row(
99- "Theme",65+ Editable {
100- segmented(66+ id: "save_username_button",
101- Theme::ALL.map(|choice| (choice, choice.label())),67+ label: "Username",
102- self.settings.theme,68+ input: &self.chat.username_input,
103- entity,69+ current: &user.username,
104- palette,70+ save: Yumush::save_username,
105- Yumush::set_theme,71+ },
106- ),72+ entity,
73+ palette,
74+ cx,
107 ),75 ),
108- row(76+ text_row(
109- "Font size",77+ Editable {
110- segmented(78+ id: "save_status_button",
111- FontSize::ALL.map(|size| (size, size.label())),79+ label: "Status",
112- self.settings.font_size,80+ input: &self.chat.status_input,
113- entity,81+ current: &user.status,
114- palette,82+ save: Yumush::save_status,
115- Yumush::set_font_size,83+ },
116- ),84+ entity,
117- ),85+ palette,
118- row(86+ cx,
119- "Close to tray",
120- super::parts::toggle(
121- "close_to_tray_switch",
122- self.settings.close_to_tray,
123- palette.tokens,
124- {
125- let entity = entity.clone();
126- move |_, cx| {
127- entity.update(cx, |yumush, cx| {
128- yumush.settings.close_to_tray = !yumush.settings.close_to_tray;
129- yumush.commit_settings(cx);
130- })
131- }
132- },
133- ),
134 ),87 ),
135 ],88 ],
136- )89+ ));
137- .into_any_element(),90+ }
138- );91+ sections.push(section(
92+ "Voice",
93+ palette,
94+ self.voice_rows(entity, palette, cx),
95+ ));
96+ sections.push(section(
97+ "Appearance",
98+ palette,
99+ vec![
100+ row(
101+ "Theme",
102+ segmented(
103+ Theme::ALL.map(|choice| (choice, choice.label())),
104+ self.settings.theme,
105+ entity,
106+ palette,
107+ Yumush::set_theme,
108+ ),
109+ ),
110+ row(
111+ "Font size",
112+ segmented(
113+ FontSize::ALL.map(|size| (size, size.label())),
114+ self.settings.font_size,
115+ entity,
116+ palette,
117+ Yumush::set_font_size,
118+ ),
119+ ),
120+ row(
121+ "Close to tray",
122+ super::parts::toggle(
123+ "close_to_tray_switch",
124+ self.settings.close_to_tray,
125+ palette.tokens,
126+ {
127+ let entity = entity.clone();
128+ move |_, cx| {
129+ entity.update(cx, |yumush, cx| {
130+ yumush.settings.close_to_tray = !yumush.settings.close_to_tray;
131+ yumush.commit_settings(cx);
132+ })
133+ }
134+ },
135+ ),
136+ ),
137+ ],
138+ ));
139 if self.user.is_some() {139 if self.user.is_some() {
140- sections.push(140+ sections.push(danger_section(
141- danger_section(141+ palette,
142- palette,142+ vec![row(
143- vec![row(143+ "Delete account",
144- "Delete account",144+ delete_control(
145- delete_control(145+ "delete_account_button",
146- "delete_account_button",146+ self.chat.delete_step,
147- self.chat.delete_step,147+ entity,
148- entity,148+ palette,
149- palette,149+ Yumush::delete_account,
150- Yumush::delete_account,150+ ),
151- ),151+ )],
152- )],152+ ));
153- )
154- .into_any_element(),
155- );
156 }153 }
157 154
158- page("settings_scroll", entity, palette, "Settings", sections)155+ page(
156+ "settings_scroll",
157+ entity,
158+ palette,
159+ "Settings",
160+ sections,
161+ self.chat.section,
162+ )
159 }163 }
160 164
161 pub(super) fn set_user(&mut self, user: User, cx: &mut Context<Self>) {165 pub(super) fn set_user(&mut self, user: User, cx: &mut Context<Self>) {
@@ -310,31 +314,61 @@ pub(super) fn header(
310 314
311 div()315 div()
312 .h(px(size::ROW))316 .h(px(size::ROW))
313- .px(px(space::MD))317+ .px(px(space::LG))
314 .flex()318 .flex()
315 .items_center()319 .items_center()
316- .gap(px(space::SM))320+ .child(
317- .border_b_1()321+ clickable("settings_back_button", palette, move |window, cx| {
318- .border_color(palette.border)
319- .child(icon_button(
320- "settings_back_button",
321- palette,
322- IconName::ArrowLeft,
323- "Back",
324- move |window, cx| {
325 entity.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx));322 entity.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx));
326- },323+ })
327- ))324+ .tip("Back")
328- .child(div().font_weight(FontWeight::SEMIBOLD).child(title))325+ .h(px(size::CONTROL_SM))
326+ .px(px(space::SM))
327+ .rounded(px(radius::MD))
328+ .flex()
329+ .items_center()
330+ .gap(px(space::XS))
331+ .font_weight(FontWeight::MEDIUM)
332+ .child(Icon::new(IconName::ChevronLeft).size(px(size::ICON_SM)))
333+ .child(title),
334+ )
329 }335 }
330 336
337+pub(super) struct Section(pub &'static str, pub AnyElement);
338+
331 pub(super) fn page(339 pub(super) fn page(
332 id: &'static str,340 id: &'static str,
333 entity: &Entity<Yumush>,341 entity: &Entity<Yumush>,
334 palette: Palette,342 palette: Palette,
335 title: impl IntoElement,343 title: impl IntoElement,
336- sections: Vec<AnyElement>,344+ sections: Vec<Section>,
345+ selected: usize,
337 ) -> impl IntoElement {346 ) -> impl IntoElement {
347+ let selected = selected.min(sections.len().saturating_sub(1));
348+ let index: Vec<_> = sections
349+ .iter()
350+ .enumerate()
351+ .map(|(position, Section(name, _))| {
352+ let entity = entity.clone();
353+ super::parts::index_item(
354+ gpui_kit::ElementId::Name(format!("{id}_index_{name}").into()),
355+ *name,
356+ position == selected,
357+ palette.tokens,
358+ move |_, cx| {
359+ entity.update(cx, |yumush, cx| {
360+ yumush.chat.section = position;
361+ cx.notify();
362+ })
363+ },
364+ )
365+ })
366+ .collect();
367+ let body = sections
368+ .into_iter()
369+ .nth(selected)
370+ .map(|Section(_, body)| body);
371+
338 div()372 div()
339 .flex_1()373 .flex_1()
340 .min_h_0()374 .min_h_0()
@@ -343,62 +377,56 @@ pub(super) fn page(
343 .child(header(entity, palette, title))377 .child(header(entity, palette, title))
344 .child(378 .child(
345 div()379 div()
346- .id(id)
347 .flex_1()380 .flex_1()
348 .min_h_0()381 .min_h_0()
349- .overflow_y_scroll()
350 .flex()382 .flex()
351- .justify_center()
352 .child(383 .child(
353 div()384 div()
354- .w_full()385+ .w(px(size::SIDEBAR))
355- .max_w(px(size::PAGE))386+ .flex_shrink_0()
356 .px(px(space::XL))387 .px(px(space::XL))
357- .py(px(space::XXL))388+ .py(px(space::LG))
358 .flex()389 .flex()
359 .flex_col()390 .flex_col()
360- .gap(px(space::XXL))391+ .children(index),
361- .children(sections),392+ )
393+ .child(
394+ div()
395+ .id(id)
396+ .flex_1()
397+ .min_w_0()
398+ .min_h_0()
399+ .overflow_y_scroll()
400+ .child(
401+ div()
402+ .w_full()
403+ .max_w(px(size::PAGE))
404+ .px(px(space::XL))
405+ .py(px(space::LG))
406+ .children(body),
407+ ),
362 ),408 ),
363 )409 )
364 }410 }
365 411
366-pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) -> impl IntoElement {412+pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) -> Section {
367- card(title, palette.muted, palette, rows)413+ Section(title, rows_column(palette, rows))
368 }414 }
369 415
370-pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> impl IntoElement {416+pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> Section {
371- card("Danger zone", palette.danger, palette, rows)417+ Section("Danger zone", rows_column(palette, rows))
372 }418 }
373 419
374-fn card(420+fn rows_column(palette: Palette, rows: Vec<Div>) -> AnyElement {
375- title: &'static str,
376- title_color: Hsla,
377- palette: Palette,
378- rows: Vec<Div>,
379-) -> impl IntoElement {
380 div()421 div()
381 .flex()422 .flex()
382 .flex_col()423 .flex_col()
383- .gap(px(space::SM))424+ .children(rows.into_iter().enumerate().map(|(index, row)| {
384- .child(425+ row.when(index > 0, |row| {
385- div()426+ row.border_t_1().border_color(palette.border)
386- .px(px(space::XXS))427+ })
387- .text_size(text(text::CAPTION))428+ }))
388- .font_weight(FontWeight::MEDIUM)429+ .into_any_element()
389- .text_color(title_color)
390- .child(title),
391- )
392- .child(
393- div()
394- .flex()
395- .flex_col()
396- .children(rows.into_iter().enumerate().map(|(index, row)| {
397- row.when(index > 0, |row| {
398- row.border_t_1().border_color(palette.border)
399- })
400- })),
401- )
402 }430 }
403 431
404 pub(super) struct Editable<'a> {432 pub(super) struct Editable<'a> {
@@ -628,7 +656,11 @@ pub(super) fn segmented<T: Copy + PartialEq + 'static>(
628 .gap(px(space::XXS))656 .gap(px(space::XXS))
629 .text_size(text(text::UI))657 .text_size(text(text::UI))
630 .font_weight(FontWeight::MEDIUM)658 .font_weight(FontWeight::MEDIUM)
631- .text_color(if on { palette.tokens.paper() } else { palette.muted })659+ .text_color(if on {
660+ palette.tokens.paper()
661+ } else {
662+ palette.muted
663+ })
632 .on_click(move |_, _, cx| {664 .on_click(move |_, _, cx| {
633 entity.update(cx, |yumush, cx| select(yumush, choice, cx));665 entity.update(cx, |yumush, cx| select(yumush, choice, cx));
634 })666 })
crates/client/src/gui/share_view.rsmodified+12 -14
@@ -947,20 +947,18 @@ fn include_row(
947 let included = !is_excluded(&settings.excluded, &app.name, app.pid);947 let included = !is_excluded(&settings.excluded, &app.name, app.pid);
948 let target = app.clone();948 let target = app.clone();
949 949
950- row_style(div()).child(name_cell(app, palette)).child(950+ row_style(div())
951- div().flex_shrink_0().child(951+ .child(name_cell(app, palette))
952- super::parts::toggle(952+ .child(div().flex_shrink_0().child(super::parts::toggle(
953- gpui_kit::ElementId::Name(format!("share_app_{}", app.key()).into()),953+ gpui_kit::ElementId::Name(format!("share_app_{}", app.key()).into()),
954- included,954+ included,
955- palette.tokens,955+ palette.tokens,
956- move |_, cx| {956+ move |_, cx| {
957- entity.update(cx, |yumush, cx| {957+ entity.update(cx, |yumush, cx| {
958- yumush.set_share_included(&target, !included, cx)958+ yumush.set_share_included(&target, !included, cx)
959- });959+ });
960- },960+ },
961- ),961+ )))
962- ),
963- )
964 }962 }
965 963
966 fn pick_row(964 fn pick_row(
crates/client/src/gui/sidebar.rsmodified+24 -4
@@ -235,7 +235,11 @@ impl Yumush {
235 .min_w_0()235 .min_w_0()
236 .truncate()236 .truncate()
237 .text_size(text(text::LABEL))237 .text_size(text(text::LABEL))
238- .text_color(if speaking { palette.text } else { palette.muted })238+ .text_color(if speaking {
239+ palette.text
240+ } else {
241+ palette.muted
242+ })
239 .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD))243 .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD))
240 .child(user.username.clone()),244 .child(user.username.clone()),
241 )245 )
@@ -686,7 +690,13 @@ impl Yumush {
686 palette,690 palette,
687 false,691 false,
688 presence_avatar(692 presence_avatar(
689- avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),693+ avatar(
694+ palette,
695+ user,
696+ px(size::AVATAR),
697+ text(text::CAPTION),
698+ &self.chat.avatars,
699+ ),
690 self.presence_of(user.id),700 self.presence_of(user.id),
691 px(size::AVATAR),701 px(size::AVATAR),
692 palette,702 palette,
@@ -835,7 +845,13 @@ impl Yumush {
835 .px(px(space::SM))845 .px(px(space::SM))
836 .rounded(px(radius::MD))846 .rounded(px(radius::MD))
837 .child(presence_avatar(847 .child(presence_avatar(
838- avatar(palette, user, px(size::AVATAR), text(text::CAPTION), &self.chat.avatars),848+ avatar(
849+ palette,
850+ user,
851+ px(size::AVATAR),
852+ text(text::CAPTION),
853+ &self.chat.avatars,
854+ ),
839 self.presence_of(user.id),855 self.presence_of(user.id),
840 px(size::AVATAR),856 px(size::AVATAR),
841 palette,857 palette,
@@ -922,7 +938,11 @@ fn watch_pill(
922 .child(938 .child(
923 Icon::new(icon)939 Icon::new(icon)
924 .size(px(size::ICON_SM))940 .size(px(size::ICON_SM))
925- .text_color(if watching { palette.text } else { palette.muted }),941+ .text_color(if watching {
942+ palette.text
943+ } else {
944+ palette.muted
945+ }),
926 )946 )
927 .children(wave.map(|history| mini_wave(history, 10., palette.screen)))947 .children(wave.map(|history| mini_wave(history, 10., palette.screen)))
928 }948 }
crates/client/src/gui/snippet.rsmodified+7 -1
@@ -66,7 +66,13 @@ fn snippet_row(
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(size::AVATAR), super::text(text::CAPTION), &chat.avatars),69+ avatar(
70+ palette,
71+ &user,
72+ px(size::AVATAR),
73+ super::text(text::CAPTION),
74+ &chat.avatars,
75+ ),
70 ))76 ))
71 .child(77 .child(
72 div()78 div()
crates/client/src/gui/social.rsmodified+2 -1
@@ -21,8 +21,9 @@ use gpui_kit::{
21 };21 };
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,
25 style::{radius, size, space},25 style::{radius, size, space},
26+ text,
26 widget::{search_text, spawn_done},27 widget::{search_text, spawn_done},
27 };28 };
28 29
crates/client/src/gui/style.rsmodified+13 -3
@@ -143,7 +143,9 @@ mod tests {
143 let literal = |pattern: &str| {143 let literal = |pattern: &str| {
144 line.match_indices(pattern).any(|(at, _)| {144 line.match_indices(pattern).any(|(at, _)| {
145 let rest = &line[at + pattern.len()..];145 let rest = &line[at + pattern.len()..];
146- rest.chars().next().is_some_and(|next| next.is_ascii_digit())146+ rest.chars()
147+ .next()
148+ .is_some_and(|next| next.is_ascii_digit())
147 && !rest.starts_with("0.)")149 && !rest.starts_with("0.)")
148 && !rest.starts_with("0.0)")150 && !rest.starts_with("0.0)")
149 })151 })
@@ -166,7 +168,11 @@ mod tests {
166 sources(&src.join("gui"), &mut files);168 sources(&src.join("gui"), &mut files);
167 let mut found = Vec::new();169 let mut found = Vec::new();
168 for file in files {170 for file in files {
169- let name = file.strip_prefix(&src).expect("under src").to_string_lossy().replace('\\', "/");171+ let name = file
172+ .strip_prefix(&src)
173+ .expect("under src")
174+ .to_string_lossy()
175+ .replace('\\', "/");
170 if FREE.contains(&name.as_str()) || UNMIGRATED.contains(&name.as_str()) {176 if FREE.contains(&name.as_str()) || UNMIGRATED.contains(&name.as_str()) {
171 continue;177 continue;
172 }178 }
@@ -177,6 +183,10 @@ mod tests {
177 }183 }
178 }184 }
179 }185 }
180- assert!(found.is_empty(), "raw values outside tokens:\n{}", found.join("\n"));186+ assert!(
187+ found.is_empty(),
188+ "raw values outside tokens:\n{}",
189+ found.join("\n")
190+ );
181 }191 }
182 }192 }
crates/client/src/gui/voice_settings.rsmodified+12 -9
@@ -220,11 +220,19 @@ impl Yumush {
220 let mut rows = vec![220 let mut rows = vec![
221 row(221 row(
222 "Input device",222 "Input device",
223- div().child(Select::new(&controls.inputs).w(px(size::SIDEBAR))),223+ div().child(
224+ Select::new(&controls.inputs)
225+ .appearance(false)
226+ .w(px(size::SIDEBAR)),
227+ ),
224 ),228 ),
225 row(229 row(
226 "Output device",230 "Output device",
227- div().child(Select::new(&controls.outputs).w(px(size::SIDEBAR))),231+ div().child(
232+ Select::new(&controls.outputs)
233+ .appearance(false)
234+ .w(px(size::SIDEBAR)),
235+ ),
228 ),236 ),
229 row(237 row(
230 "Input volume",238 "Input volume",
@@ -540,11 +548,6 @@ fn test_button(
540 .items_center()548 .items_center()
541 .gap(px(space::SM))549 .gap(px(space::SM))
542 .rounded(px(radius::MD))550 .rounded(px(radius::MD))
543- .border_1()551+ .font_weight(gpui_kit::FontWeight::MEDIUM)
544- .border_color(if active {552+ .text_color(if active { palette.text } else { palette.muted })
545- palette.accent
546- } else {
547- palette.border
548- })
549- .text_color(if active { palette.text } else { palette.body })
550 }553 }
crates/client/src/gui/voice_stats.rsmodified+28 -9
@@ -252,7 +252,9 @@ fn layer_row(index: usize, stats: &LayerStats, max: f32, kind: Kind, palette: Pa
252 .rounded(px(radius::MD))252 .rounded(px(radius::MD))
253 .bg(palette.hover)253 .bg(palette.hover)
254 .text_size(text_size(text::CAPTION))254 .text_size(text_size(text::CAPTION))
255- .when(stats.kbps == 0, |this| this.text_color(palette.tokens.faint()))255+ .when(stats.kbps == 0, |this| {
256+ this.text_color(palette.tokens.faint())
257+ })
256 .child(258 .child(
257 div()259 div()
258 .w(px(size::CHIP))260 .w(px(size::CHIP))
@@ -335,11 +337,15 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette:
335 .text_color(kind_color(kind, palette)),337 .text_color(kind_color(kind, palette)),
336 )338 )
337 .child(339 .child(
338- div().w(px(WATCH_LAYER_W)).flex_none().text_color(palette.text).child(340+ div()
339- stats341+ .w(px(WATCH_LAYER_W))
340- .layer342+ .flex_none()
341- .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps)),343+ .text_color(palette.text)
342- ),344+ .child(
345+ stats
346+ .layer
347+ .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps)),
348+ ),
343 )349 )
344 .child(350 .child(
345 div()351 div()
@@ -418,7 +424,12 @@ fn usage_block(usage: &Usage, palette: Palette) -> Div {
418 }424 }
419 425
420 fn column() -> Div {426 fn column() -> Div {
421- div().flex().flex_col().gap(px(space::SM)).flex_1().min_w_0()427+ div()
428+ .flex()
429+ .flex_col()
430+ .gap(px(space::SM))
431+ .flex_1()
432+ .min_w_0()
422 }433 }
423 434
424 fn model_header(icon: IconName, title: &'static str, model: &str, palette: Palette) -> Div {435 fn model_header(icon: IconName, title: &'static str, model: &str, palette: Palette) -> Div {
@@ -604,7 +615,10 @@ fn header(icon: IconName, title: &'static str, color: Hsla) -> Div {
604 }615 }
605 616
606 fn label(value: &'static str, color: Hsla) -> Div {617 fn label(value: &'static str, color: Hsla) -> Div {
607- div().text_size(text_size(text::CAPTION)).text_color(color).child(value)618+ div()
619+ .text_size(text_size(text::CAPTION))
620+ .text_color(color)
621+ .child(value)
608 }622 }
609 623
610 fn chip(value: impl gpui_kit::IntoElement, color: Hsla, palette: Palette) -> Div {624 fn chip(value: impl gpui_kit::IntoElement, color: Hsla, palette: Palette) -> Div {
@@ -632,7 +646,12 @@ fn stat_cell(label: &'static str, value: String, color: Hsla, palette: Palette)
632 .text_color(palette.muted)646 .text_color(palette.muted)
633 .child(label),647 .child(label),
634 )648 )
635- .child(div().text_size(text_size(text::UI)).text_color(color).child(value))649+ .child(
650+ div()
651+ .text_size(text_size(text::UI))
652+ .text_color(color)
653+ .child(value),
654+ )
636 }655 }
637 656
638 fn avatar_dot(name: &str, color: Hsla, palette: Palette) -> Div {657 fn avatar_dot(name: &str, color: Hsla, palette: Palette) -> Div {