One voice line per person, louder meter, call events on the thread, builder list like chat, settings Profile/Camera & share/hue in Appearance, 15fps strip tiles
Browse files at this commit1b03f20504a0917fc380f7c3a04da5ac6bdec034Parent: 2a068cb- feat
- one voice line per person, louder meter, call events on the thread, builder list like chat, settings Profile/Camera & share/hue in Appearance, 15fps strip tiles
7 changed files +411 -208
- crates/client/src/gui/builder/messages.rs +70 -38
- crates/client/src/gui/camera_view.rs +25 -39
- crates/client/src/gui/chat.rs +20 -4
- crates/client/src/gui/parts.rs +14 -3
- crates/client/src/gui/settings_page.rs +263 -77
- crates/client/src/gui/share_view.rs +4 -4
- crates/client/src/gui/sidebar.rs +15 -43
crates/client/src/gui/builder/messages.rsmodified+70 -38
| @@ -4,7 +4,8 @@ use common::{ | |||
| 4 | model::MessageHit, | 4 | model::MessageHit, |
| 5 | }; | 5 | }; |
| 6 | use gpui_kit::{ | 6 | use gpui_kit::{ |
| 7 | - AnyElement, Context, Div, Entity, FontWeight, IntoElement, ParentElement, Styled, Window, | 7 | + AnyElement, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement, ParentElement, |
| 8 | + Styled, Window, | ||
| 8 | assets::IconName, | 9 | assets::IconName, |
| 9 | component::{WindowExt, notification::Notification}, | 10 | component::{WindowExt, notification::Notification}, |
| 10 | div, | 11 | div, |
| @@ -13,13 +14,12 @@ use gpui_kit::{ | |||
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | use super::ui::{ | 16 | use super::ui::{ |
| 16 | - accent_button, card, confirmed, delete_icon_button, end_of_day_ms, icon_button, list_card, | 17 | + accent_button, card, confirmed, delete_icon_button, end_of_day_ms, icon_button, 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::style::{size, space, stroke, text}; |
| 21 | use crate::gui::{ | 21 | use crate::gui::{ |
| 22 | - Palette, Yumush, avatar, | 22 | + Palette, Yumush, |
| 23 | community_settings::user_name, | 23 | community_settings::user_name, |
| 24 | entity_action, millis_time, notify_error, | 24 | entity_action, millis_time, notify_error, |
| 25 | profile::user_link, | 25 | profile::user_link, |
| @@ -31,12 +31,18 @@ fn message_hit_row( | |||
| 31 | hit: &MessageHit, | 31 | hit: &MessageHit, |
| 32 | pending: bool, | 32 | pending: bool, |
| 33 | purge_pending: bool, | 33 | purge_pending: bool, |
| 34 | - picture: Div, | ||
| 35 | entity: &Entity<Yumush>, | 34 | entity: &Entity<Yumush>, |
| 36 | palette: Palette, | 35 | palette: Palette, |
| 37 | ) -> Div { | 36 | ) -> Div { |
| 38 | let message_id = hit.message.id; | 37 | let message_id = hit.message.id; |
| 39 | let community_id = hit.message.community_id; | 38 | let community_id = hit.message.community_id; |
| 39 | + let group = format!("hit_{}", hit.message.id); | ||
| 40 | + let hue = hit | ||
| 41 | + .author | ||
| 42 | + .as_ref() | ||
| 43 | + .map_or(palette.tokens.faint(), |author| { | ||
| 44 | + palette.tokens.person(author.id) | ||
| 45 | + }); | ||
| 40 | let open = icon_button( | 46 | let open = icon_button( |
| 41 | format!("open_message_{}", hit.message.id), | 47 | format!("open_message_{}", hit.message.id), |
| 42 | IconName::MessageSquare, | 48 | IconName::MessageSquare, |
| @@ -76,13 +82,26 @@ fn message_hit_row( | |||
| 76 | }) | 82 | }) |
| 77 | }); | 83 | }); |
| 78 | 84 | ||
| 79 | - list_row() | 85 | + let dot = div() |
| 80 | - .child(user_link( | 86 | + .absolute() |
| 81 | - format!("hit_picture_{}", hit.message.id), | 87 | + .left(px(space::XL - space::SM / 2.0)) |
| 82 | - hit.author.as_ref(), | 88 | + .top(px(space::SM)) |
| 83 | - entity, | 89 | + .size(px(space::SM)) |
| 84 | - picture, | 90 | + .rounded_full() |
| 85 | - )) | 91 | + .bg(hue); |
| 92 | + | ||
| 93 | + div() | ||
| 94 | + .group(group.clone()) | ||
| 95 | + .relative() | ||
| 96 | + .flex() | ||
| 97 | + .items_start() | ||
| 98 | + .gap(px(space::MD)) | ||
| 99 | + .min_w_0() | ||
| 100 | + .py(px(space::SM)) | ||
| 101 | + .pl(px(space::XL + space::LG)) | ||
| 102 | + .pr(px(space::LG)) | ||
| 103 | + .hover(|style| style.bg(palette.hover)) | ||
| 104 | + .child(dot) | ||
| 86 | .child( | 105 | .child( |
| 87 | div() | 106 | div() |
| 88 | .flex_1() | 107 | .flex_1() |
| @@ -103,24 +122,24 @@ fn message_hit_row( | |||
| 103 | div() | 122 | div() |
| 104 | .truncate() | 123 | .truncate() |
| 105 | .text_size(text(text::LABEL)) | 124 | .text_size(text(text::LABEL)) |
| 106 | - .font_weight(FontWeight::MEDIUM) | 125 | + .font_weight(FontWeight::SEMIBOLD) |
| 107 | - .text_color(palette.text) | 126 | + .text_color(hue) |
| 108 | .child(user_name(&hit.author).to_string()), | 127 | .child(user_name(&hit.author).to_string()), |
| 109 | )) | 128 | )) |
| 110 | .child( | 129 | .child( |
| 111 | div() | 130 | div() |
| 112 | - .min_w_0() | 131 | + .flex_shrink_0() |
| 113 | - .truncate() | ||
| 114 | .text_size(text(text::CAPTION)) | 132 | .text_size(text(text::CAPTION)) |
| 115 | .text_color(palette.muted) | 133 | .text_color(palette.muted) |
| 116 | - .child(hit.community.clone()), | 134 | + .child(millis_time(hit.message.created_at, YEAR_STAMP)), |
| 117 | ) | 135 | ) |
| 118 | .child( | 136 | .child( |
| 119 | div() | 137 | div() |
| 120 | - .flex_shrink_0() | 138 | + .min_w_0() |
| 139 | + .truncate() | ||
| 121 | .text_size(text(text::CAPTION)) | 140 | .text_size(text(text::CAPTION)) |
| 122 | - .text_color(palette.muted) | 141 | + .text_color(palette.tokens.faint()) |
| 123 | - .child(millis_time(hit.message.created_at, YEAR_STAMP)), | 142 | + .child(hit.community.clone()), |
| 124 | ), | 143 | ), |
| 125 | ) | 144 | ) |
| 126 | .child(match hit.message.call { | 145 | .child(match hit.message.call { |
| @@ -128,7 +147,7 @@ fn message_hit_row( | |||
| 128 | crate::gui::chat::call_line(call, user_name(&hit.author), false, palette) | 147 | crate::gui::chat::call_line(call, user_name(&hit.author), false, palette) |
| 129 | } | 148 | } |
| 130 | None => div() | 149 | None => div() |
| 131 | - .text_size(text(text::LABEL)) | 150 | + .text_size(text(text::BODY)) |
| 132 | .text_color(palette.body) | 151 | .text_color(palette.body) |
| 133 | .line_clamp(2) | 152 | .line_clamp(2) |
| 134 | .child(hit.message.body.clone()), | 153 | .child(hit.message.body.clone()), |
| @@ -136,10 +155,13 @@ fn message_hit_row( | |||
| 136 | ) | 155 | ) |
| 137 | .child( | 156 | .child( |
| 138 | div() | 157 | div() |
| 158 | + .id(format!("hit_actions_{}", hit.message.id)) | ||
| 139 | .flex() | 159 | .flex() |
| 140 | .items_center() | 160 | .items_center() |
| 141 | .gap(px(space::XS)) | 161 | .gap(px(space::XS)) |
| 142 | .flex_shrink_0() | 162 | .flex_shrink_0() |
| 163 | + .invisible() | ||
| 164 | + .group_hover(group, |style| style.visible()) | ||
| 143 | .child(open) | 165 | .child(open) |
| 144 | .child(delete) | 166 | .child(delete) |
| 145 | .children(purge), | 167 | .children(purge), |
| @@ -201,27 +223,37 @@ impl Yumush { | |||
| 201 | .author | 223 | .author |
| 202 | .as_ref() | 224 | .as_ref() |
| 203 | .is_some_and(|author| self.chat.pending_builder_purge == Some(author.id)); | 225 | .is_some_and(|author| self.chat.pending_builder_purge == Some(author.id)); |
| 204 | - let picture = match &hit.author { | 226 | + message_hit_row(hit, pending, purge_pending, entity, palette) |
| 205 | - Some(author) => avatar( | ||
| 206 | - palette, | ||
| 207 | - author, | ||
| 208 | - px(size::AVATAR), | ||
| 209 | - text(text::CAPTION), | ||
| 210 | - &self.chat.avatars, | ||
| 211 | - ), | ||
| 212 | - None => div() | ||
| 213 | - .size(px(size::AVATAR)) | ||
| 214 | - .flex_shrink_0() | ||
| 215 | - .rounded_full() | ||
| 216 | - .bg(palette.hover), | ||
| 217 | - }; | ||
| 218 | - message_hit_row(hit, pending, purge_pending, picture, entity, palette) | ||
| 219 | }) | 227 | }) |
| 220 | .collect(); | 228 | .collect(); |
| 229 | + let list = if rows.is_empty() { | ||
| 230 | + div() | ||
| 231 | + .py(px(space::XL)) | ||
| 232 | + .flex() | ||
| 233 | + .justify_center() | ||
| 234 | + .text_size(text(text::CAPTION)) | ||
| 235 | + .text_color(palette.muted) | ||
| 236 | + .child("No messages") | ||
| 237 | + } else { | ||
| 238 | + div() | ||
| 239 | + .relative() | ||
| 240 | + .flex() | ||
| 241 | + .flex_col() | ||
| 242 | + .child( | ||
| 243 | + div() | ||
| 244 | + .absolute() | ||
| 245 | + .left(px(space::XL)) | ||
| 246 | + .top_0() | ||
| 247 | + .bottom_0() | ||
| 248 | + .w(px(stroke::LINE)) | ||
| 249 | + .bg(palette.tokens.thread()), | ||
| 250 | + ) | ||
| 251 | + .children(rows) | ||
| 252 | + }; | ||
| 221 | 253 | ||
| 222 | vec![ | 254 | vec![ |
| 223 | card(palette).child(filters).into_any_element(), | 255 | card(palette).child(filters).into_any_element(), |
| 224 | - list_card(None, rows, "No messages", palette).into_any_element(), | 256 | + card(palette).child(list).into_any_element(), |
| 225 | ] | 257 | ] |
| 226 | } | 258 | } |
| 227 | 259 | ||
crates/client/src/gui/camera_view.rsmodified+25 -39
| @@ -6,7 +6,7 @@ use common::share::{Fps, Kind, Quality, Resolution}; | |||
| 6 | use gpui_kit::{ | 6 | use gpui_kit::{ |
| 7 | AnyElement, AppContext as _, Context, Div, Entity, InteractiveElement, IntoElement, | 7 | AnyElement, AppContext as _, Context, Div, Entity, 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, prelude::FluentBuilder as _, px, |
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | use super::{ | 12 | use super::{ |
| @@ -30,7 +30,7 @@ const TILE_H: f32 = TILE_W * 9. / 16.; | |||
| 30 | 30 | ||
| 31 | pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality { | 31 | pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality { |
| 32 | resolution: Resolution::P360, | 32 | resolution: Resolution::P360, |
| 33 | - fps: Fps::F30, | 33 | + fps: Fps::F15, |
| 34 | }); | 34 | }); |
| 35 | 35 | ||
| 36 | #[derive(Clone, Copy, PartialEq, Eq)] | 36 | #[derive(Clone, Copy, PartialEq, Eq)] |
| @@ -254,7 +254,8 @@ impl Yumush { | |||
| 254 | .voice_community() | 254 | .voice_community() |
| 255 | .map(|community_id| self.chat.voice_ids(community_id).to_vec()) | 255 | .map(|community_id| self.chat.voice_ids(community_id).to_vec()) |
| 256 | .unwrap_or_default(); | 256 | .unwrap_or_default(); |
| 257 | - self.voices_of(&ids, palette) | 257 | + let others: Vec<Id> = ids.into_iter().filter(|id| !self.is_me(*id)).collect(); |
| 258 | + self.voices_of(&others, palette) | ||
| 258 | } | 259 | } |
| 259 | 260 | ||
| 260 | fn slots(&self, ids: &[Id]) -> (Vec<Id>, usize) { | 261 | fn slots(&self, ids: &[Id]) -> (Vec<Id>, usize) { |
| @@ -293,6 +294,7 @@ impl Yumush { | |||
| 293 | voice_line(self.chat.waves.voice(user.id), voice, t), | 294 | voice_line(self.chat.waves.voice(user.id), voice, t), |
| 294 | t, | 295 | t, |
| 295 | ) | 296 | ) |
| 297 | + .h(px(size::CONTROL_SM)) | ||
| 296 | }) | 298 | }) |
| 297 | .chain( | 299 | .chain( |
| 298 | (more > 0) | 300 | (more > 0) |
| @@ -359,7 +361,7 @@ impl Yumush { | |||
| 359 | .chat | 361 | .chat |
| 360 | .voice_ids(community_id) | 362 | .voice_ids(community_id) |
| 361 | .iter() | 363 | .iter() |
| 362 | - .filter(|id| !sources.contains(&(**id, Kind::Camera))) | 364 | + .filter(|id| !sources.contains(&(**id, Kind::Camera)) && !self.is_me(**id)) |
| 363 | .copied() | 365 | .copied() |
| 364 | .collect(); | 366 | .collect(); |
| 365 | let columns = ((sources.len() as f32).sqrt().ceil() as usize).max(1); | 367 | let columns = ((sources.len() as f32).sqrt().ceil() as usize).max(1); |
| @@ -489,19 +491,13 @@ fn stage_tile( | |||
| 489 | .bg(t.raise()) | 491 | .bg(t.raise()) |
| 490 | .children(surface), | 492 | .children(surface), |
| 491 | ) | 493 | ) |
| 492 | - .child(caption( | 494 | + .child(tile_name( |
| 493 | name, | 495 | name, |
| 494 | - voice_line( | 496 | + if speaking || focused { |
| 495 | - yumush.chat.waves.voice(user_id), | 497 | + Ink::Paper |
| 496 | - if speaking { | 498 | + } else { |
| 497 | - Voice::Live(t.person(user_id)) | 499 | + Ink::Dim |
| 498 | - } else if focused { | 500 | + }, |
| 499 | - Voice::Live(t.paper()) | ||
| 500 | - } else { | ||
| 501 | - Voice::Quiet | ||
| 502 | - }, | ||
| 503 | - t, | ||
| 504 | - ), | ||
| 505 | t, | 501 | t, |
| 506 | )) | 502 | )) |
| 507 | } | 503 | } |
| @@ -580,17 +576,9 @@ fn grid_cell( | |||
| 580 | .bg(t.raise()) | 576 | .bg(t.raise()) |
| 581 | .children(surface), | 577 | .children(surface), |
| 582 | ) | 578 | ) |
| 583 | - .child(caption( | 579 | + .child(tile_name( |
| 584 | name, | 580 | name, |
| 585 | - voice_line( | 581 | + if speaking { Ink::Paper } else { Ink::Dim }, |
| 586 | - yumush.chat.waves.voice(user_id), | ||
| 587 | - if speaking { | ||
| 588 | - Voice::Live(t.person(user_id)) | ||
| 589 | - } else { | ||
| 590 | - Voice::Quiet | ||
| 591 | - }, | ||
| 592 | - t, | ||
| 593 | - ), | ||
| 594 | t, | 582 | t, |
| 595 | )) | 583 | )) |
| 596 | .into_any_element() | 584 | .into_any_element() |
| @@ -607,20 +595,10 @@ pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, K | |||
| 607 | || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted)); | 595 | || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted)); |
| 608 | 596 | ||
| 609 | scrim(t) | 597 | scrim(t) |
| 610 | - .child(words(name, Text::Label, Ink::Paper, t).flex_none()) | ||
| 611 | .child( | 598 | .child( |
| 612 | - div() | 599 | + words(name, Text::Label, Ink::Paper, t) |
| 613 | - .w(px(size::CONTROL)) | 600 | + .flex_none() |
| 614 | - .h(px(space::MD)) | 601 | + .when(speaking, |name| name.text_color(t.person(user_id))), |
| 615 | - .child(voice_line( | ||
| 616 | - yumush.chat.waves.voice(user_id), | ||
| 617 | - if speaking { | ||
| 618 | - Voice::Live(t.person(user_id)) | ||
| 619 | - } else { | ||
| 620 | - Voice::Quiet | ||
| 621 | - }, | ||
| 622 | - t, | ||
| 623 | - )), | ||
| 624 | ) | 602 | ) |
| 625 | .children(muted.then(|| { | 603 | .children(muted.then(|| { |
| 626 | Icon::new(IconName::MicOff) | 604 | Icon::new(IconName::MicOff) |
| @@ -628,3 +606,11 @@ pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, K | |||
| 628 | .text_color(t.bad()) | 606 | .text_color(t.bad()) |
| 629 | })) | 607 | })) |
| 630 | } | 608 | } |
| 609 | + | ||
| 610 | +fn tile_name(name: impl Into<gpui_kit::SharedString>, ink: Ink, t: super::style::Tokens) -> Div { | ||
| 611 | + div() | ||
| 612 | + .h(px(size::ICON)) | ||
| 613 | + .flex() | ||
| 614 | + .items_center() | ||
| 615 | + .child(words(name, Text::Label, ink, t)) | ||
| 616 | +} | ||
crates/client/src/gui/chat.rsmodified+20 -4
| @@ -1591,7 +1591,12 @@ impl Yumush { | |||
| 1591 | .map(|(index, message)| { | 1591 | .map(|(index, message)| { |
| 1592 | let first = index == 0 || { | 1592 | let first = index == 0 || { |
| 1593 | let previous = &self.chat.messages[index - 1]; | 1593 | let previous = &self.chat.messages[index - 1]; |
| 1594 | - previous.user_id != message.user_id || previous.call.is_some() | 1594 | + match message.call { |
| 1595 | + Some(_) => previous.call.is_none(), | ||
| 1596 | + None => { | ||
| 1597 | + previous.user_id != message.user_id || previous.call.is_some() | ||
| 1598 | + } | ||
| 1599 | + } | ||
| 1595 | }; | 1600 | }; |
| 1596 | let row = render_message( | 1601 | let row = render_message( |
| 1597 | message, | 1602 | message, |
| @@ -2869,6 +2874,7 @@ fn call_duration(seconds: u64) -> String { | |||
| 2869 | fn render_call( | 2874 | fn render_call( |
| 2870 | message: &Message, | 2875 | message: &Message, |
| 2871 | call: CallLog, | 2876 | call: CallLog, |
| 2877 | + spaced: bool, | ||
| 2872 | chat: &Chat, | 2878 | chat: &Chat, |
| 2873 | me: Option<&User>, | 2879 | me: Option<&User>, |
| 2874 | palette: Palette, | 2880 | palette: Palette, |
| @@ -2879,6 +2885,8 @@ fn render_call( | |||
| 2879 | .map_or("unknown", |user| user.username.as_str()); | 2885 | .map_or("unknown", |user| user.username.as_str()); |
| 2880 | call_line(call, author, mine, palette) | 2886 | call_line(call, author, mine, palette) |
| 2881 | .id(format!("message_row_{}", message.id)) | 2887 | .id(format!("message_row_{}", message.id)) |
| 2888 | + .relative() | ||
| 2889 | + .when(spaced, |this| this.mt(px(space::LG))) | ||
| 2882 | .into_any_element() | 2890 | .into_any_element() |
| 2883 | } | 2891 | } |
| 2884 | 2892 | ||
| @@ -2897,12 +2905,20 @@ pub(super) fn call_line(call: CallLog, author: &str, mine: bool, palette: Palett | |||
| 2897 | CallLog::Ended { seconds } => format!("Call ended · {}", call_duration(seconds)), | 2905 | CallLog::Ended { seconds } => format!("Call ended · {}", call_duration(seconds)), |
| 2898 | }; | 2906 | }; |
| 2899 | div() | 2907 | div() |
| 2908 | + .relative() | ||
| 2900 | .flex() | 2909 | .flex() |
| 2901 | .items_center() | 2910 | .items_center() |
| 2902 | - .gap(px(space::SM)) | ||
| 2903 | .text_size(text(text::CAPTION)) | 2911 | .text_size(text(text::CAPTION)) |
| 2904 | .text_color(palette.muted) | 2912 | .text_color(palette.muted) |
| 2905 | - .child(Icon::new(icon).size(px(size::ICON_SM)).text_color(color)) | 2913 | + .child( |
| 2914 | + div() | ||
| 2915 | + .absolute() | ||
| 2916 | + .left(px( | ||
| 2917 | + -(space::LG + space::XS) - (size::ICON_SM - space::SM) / 2. | ||
| 2918 | + )) | ||
| 2919 | + .bg(palette.window) | ||
| 2920 | + .child(Icon::new(icon).size(px(size::ICON_SM)).text_color(color)), | ||
| 2921 | + ) | ||
| 2906 | .child(label) | 2922 | .child(label) |
| 2907 | } | 2923 | } |
| 2908 | 2924 | ||
| @@ -2916,7 +2932,7 @@ fn render_message( | |||
| 2916 | palette: Palette, | 2932 | palette: Palette, |
| 2917 | ) -> AnyElement { | 2933 | ) -> AnyElement { |
| 2918 | if let Some(call) = message.call { | 2934 | if let Some(call) = message.call { |
| 2919 | - return render_call(message, call, chat, me, palette); | 2935 | + return render_call(message, call, first && spaced, chat, me, palette); |
| 2920 | } | 2936 | } |
| 2921 | let author = chat.author(message.user_id); | 2937 | let author = chat.author(message.user_id); |
| 2922 | let username = author.map_or("unknown", |user| user.username.as_str()); | 2938 | let username = author.map_or("unknown", |user| user.username.as_str()); |
crates/client/src/gui/parts.rsmodified+14 -3
| @@ -363,6 +363,8 @@ pub enum Voice { | |||
| 363 | Frayed, | 363 | Frayed, |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | +const STILL: f32 = 0.02; | ||
| 367 | + | ||
| 366 | pub fn voice_line(bands: Option<&VecDeque<f32>>, voice: Voice, t: Tokens) -> AnyElement { | 368 | pub fn voice_line(bands: Option<&VecDeque<f32>>, voice: Voice, t: Tokens) -> AnyElement { |
| 367 | let levels: Vec<f32> = bands | 369 | let levels: Vec<f32> = bands |
| 368 | .map(|bands| bands.iter().copied().collect()) | 370 | .map(|bands| bands.iter().copied().collect()) |
| @@ -373,6 +375,15 @@ pub fn voice_line(bands: Option<&VecDeque<f32>>, voice: Voice, t: Tokens) -> Any | |||
| 373 | Voice::Frayed => t.bad(), | 375 | Voice::Frayed => t.bad(), |
| 374 | }; | 376 | }; |
| 375 | let frayed = voice == Voice::Frayed; | 377 | let frayed = voice == Voice::Frayed; |
| 378 | + let peak = levels.iter().copied().fold(0., f32::max); | ||
| 379 | + if peak < STILL && !frayed { | ||
| 380 | + return div() | ||
| 381 | + .size_full() | ||
| 382 | + .flex() | ||
| 383 | + .items_center() | ||
| 384 | + .child(div().w_full().h(px(stroke::LINE)).bg(color)) | ||
| 385 | + .into_any_element(); | ||
| 386 | + } | ||
| 376 | canvas( | 387 | canvas( |
| 377 | |_, _, _| {}, | 388 | |_, _, _| {}, |
| 378 | move |bounds, _, window, _| { | 389 | move |bounds, _, window, _| { |
| @@ -386,11 +397,11 @@ pub fn voice_line(bands: Option<&VecDeque<f32>>, voice: Voice, t: Tokens) -> Any | |||
| 386 | } | 397 | } |
| 387 | for step in 0..=steps { | 398 | for step in 0..=steps { |
| 388 | let along = step as f32 / steps as f32; | 399 | let along = step as f32 / steps as f32; |
| 389 | - let level = sample(&levels, along); | 400 | + let level = ((sample(&levels, along) + peak) / 2.).sqrt(); |
| 390 | - let envelope = (std::f32::consts::PI * along).sin(); | 401 | + let envelope = (std::f32::consts::PI * along).sin().sqrt(); |
| 391 | let swing = (step as f32 * 0.9).sin(); | 402 | let swing = (step as f32 * 0.9).sin(); |
| 392 | let x = bounds.origin.x + bounds.size.width * along; | 403 | let x = bounds.origin.x + bounds.size.width * along; |
| 393 | - let y = middle + px(swing * level * envelope * half * 0.9); | 404 | + let y = middle + px(swing * level * envelope * half); |
| 394 | if step == 0 { | 405 | if step == 0 { |
| 395 | path.move_to(point(x, y)); | 406 | path.move_to(point(x, y)); |
| 396 | } else { | 407 | } else { |
crates/client/src/gui/settings_page.rsmodified+263 -77
| @@ -3,7 +3,8 @@ use std::future::Future; | |||
| 3 | use crate::net::Fail; | 3 | use crate::net::Fail; |
| 4 | use common::{ | 4 | use common::{ |
| 5 | call::{DeleteUser, RemoveAvatar, UpdateAvatar, UpdateHue, UpdateStatus, UpdateUser}, | 5 | call::{DeleteUser, RemoveAvatar, UpdateAvatar, UpdateHue, UpdateStatus, UpdateUser}, |
| 6 | - model::{Hue, User}, | 6 | + model::{Hue, Presence, User}, |
| 7 | + share::{self, Kind}, | ||
| 7 | }; | 8 | }; |
| 8 | use gpui_kit::{ | 9 | use gpui_kit::{ |
| 9 | AnyElement, App, AsyncWindowContext, Context, Div, Entity, FontWeight, Hsla, | 10 | AnyElement, App, AsyncWindowContext, Context, Div, Entity, FontWeight, Hsla, |
| @@ -17,12 +18,18 @@ use gpui_kit::{ | |||
| 17 | }; | 18 | }; |
| 18 | 19 | ||
| 19 | use super::{ | 20 | use super::{ |
| 20 | - Palette, Tooltip as _, Yumush, avatar, chat::DeleteStep, chat::View, clickable, notify_error, | 21 | + Palette, Tooltip as _, Yumush, avatar, |
| 21 | - primary_button, text, widget::field, | 22 | + chat::DeleteStep, |
| 23 | + chat::View, | ||
| 24 | + clickable, notify_error, parts, primary_button, | ||
| 25 | + share_view::{AudioMode, CODECS, FPS, RESOLUTIONS, share_modes}, | ||
| 26 | + text, | ||
| 27 | + widget::field, | ||
| 22 | }; | 28 | }; |
| 23 | use crate::{ | 29 | use crate::{ |
| 24 | gui::style::{self, Theme, radius, size, space, stroke, text}, | 30 | gui::style::{self, Theme, radius, size, space, stroke, text}, |
| 25 | - settings::{self, FontSize}, | 31 | + settings::{self, FontSize, ShareAudio, ShareCodec}, |
| 32 | + share::encode::capabilities, | ||
| 26 | }; | 33 | }; |
| 27 | 34 | ||
| 28 | impl Yumush { | 35 | impl Yumush { |
| @@ -34,6 +41,8 @@ impl Yumush { | |||
| 34 | ) -> impl IntoElement { | 41 | ) -> impl IntoElement { |
| 35 | let mut sections = Vec::new(); | 42 | let mut sections = Vec::new(); |
| 36 | if let Some(user) = self.user.as_ref() { | 43 | if let Some(user) = self.user.as_ref() { |
| 44 | + let presence_entity = entity.clone(); | ||
| 45 | + let logout_entity = entity.clone(); | ||
| 37 | sections.push(Section( | 46 | sections.push(Section( |
| 38 | "Profile", | 47 | "Profile", |
| 39 | div() | 48 | div() |
| @@ -59,41 +68,74 @@ impl Yumush { | |||
| 59 | entity, | 68 | entity, |
| 60 | palette, | 69 | palette, |
| 61 | )) | 70 | )) |
| 62 | - .child(row( | 71 | + .child(titled( |
| 63 | - "Hue", | 72 | + "Identity", |
| 64 | - hue_picker(Some(style::hue_of(user.id)), entity, palette), | ||
| 65 | - )) | ||
| 66 | - .into_any_element(), | ||
| 67 | - )); | ||
| 68 | - sections.push(section( | ||
| 69 | - "Account", | ||
| 70 | - palette, | ||
| 71 | - vec![ | ||
| 72 | - text_row( | ||
| 73 | - Editable { | ||
| 74 | - id: "save_username_button", | ||
| 75 | - label: "Username", | ||
| 76 | - input: &self.chat.username_input, | ||
| 77 | - current: &user.username, | ||
| 78 | - save: Yumush::save_username, | ||
| 79 | - }, | ||
| 80 | - entity, | ||
| 81 | palette, | 73 | palette, |
| 82 | - cx, | 74 | + rows_column( |
| 83 | - ), | 75 | + palette, |
| 84 | - text_row( | 76 | + vec![ |
| 85 | - Editable { | 77 | + text_row( |
| 86 | - id: "save_status_button", | 78 | + Editable { |
| 87 | - label: "Status", | 79 | + id: "save_username_button", |
| 88 | - input: &self.chat.status_input, | 80 | + label: "Name", |
| 89 | - current: &user.status, | 81 | + input: &self.chat.username_input, |
| 90 | - save: Yumush::save_status, | 82 | + current: &user.username, |
| 91 | - }, | 83 | + save: Yumush::save_username, |
| 92 | - entity, | 84 | + }, |
| 85 | + entity, | ||
| 86 | + palette, | ||
| 87 | + cx, | ||
| 88 | + ), | ||
| 89 | + text_row( | ||
| 90 | + Editable { | ||
| 91 | + id: "save_status_button", | ||
| 92 | + label: "Status", | ||
| 93 | + input: &self.chat.status_input, | ||
| 94 | + current: &user.status, | ||
| 95 | + save: Yumush::save_status, | ||
| 96 | + }, | ||
| 97 | + entity, | ||
| 98 | + palette, | ||
| 99 | + cx, | ||
| 100 | + ), | ||
| 101 | + row( | ||
| 102 | + "Presence", | ||
| 103 | + parts::options( | ||
| 104 | + "presence", | ||
| 105 | + Presence::ALL.map(|presence| (presence, presence.label())), | ||
| 106 | + self.presence_of(user.id), | ||
| 107 | + palette.tokens, | ||
| 108 | + move |presence, window, cx| { | ||
| 109 | + presence_entity.update(cx, |yumush, cx| { | ||
| 110 | + yumush.set_presence(presence, window, cx) | ||
| 111 | + }) | ||
| 112 | + }, | ||
| 113 | + ), | ||
| 114 | + ), | ||
| 115 | + ], | ||
| 116 | + ), | ||
| 117 | + )) | ||
| 118 | + .child(titled( | ||
| 119 | + "Account", | ||
| 93 | palette, | 120 | palette, |
| 94 | - cx, | 121 | + rows_column( |
| 95 | - ), | 122 | + palette, |
| 96 | - ], | 123 | + vec![row( |
| 124 | + "Log out", | ||
| 125 | + small_button( | ||
| 126 | + "logout_button", | ||
| 127 | + palette, | ||
| 128 | + palette.danger, | ||
| 129 | + move |window, cx| { | ||
| 130 | + logout_entity | ||
| 131 | + .update(cx, |yumush, cx| yumush.logout(window, cx)) | ||
| 132 | + }, | ||
| 133 | + ) | ||
| 134 | + .child("Log out"), | ||
| 135 | + )], | ||
| 136 | + ), | ||
| 137 | + )) | ||
| 138 | + .into_any_element(), | ||
| 97 | )); | 139 | )); |
| 98 | } | 140 | } |
| 99 | sections.push(section( | 141 | sections.push(section( |
| @@ -101,49 +143,56 @@ impl Yumush { | |||
| 101 | palette, | 143 | palette, |
| 102 | self.voice_rows(entity, palette, cx), | 144 | self.voice_rows(entity, palette, cx), |
| 103 | )); | 145 | )); |
| 104 | - sections.push(section( | 146 | + sections.push(Section( |
| 105 | - "Appearance", | 147 | + "Camera & share", |
| 106 | - palette, | 148 | + camera_share(self, entity, palette), |
| 107 | - vec![ | 149 | + )); |
| 108 | - row( | 150 | + let mut appearance = vec![ |
| 109 | - "Theme", | 151 | + row( |
| 110 | - segmented( | 152 | + "Theme", |
| 111 | - Theme::ALL.map(|choice| (choice, choice.label())), | 153 | + segmented( |
| 112 | - self.settings.theme, | 154 | + Theme::ALL.map(|choice| (choice, choice.label())), |
| 113 | - entity, | 155 | + self.settings.theme, |
| 114 | - palette, | 156 | + entity, |
| 115 | - Yumush::set_theme, | 157 | + palette, |
| 116 | - ), | 158 | + Yumush::set_theme, |
| 117 | ), | 159 | ), |
| 118 | - row( | 160 | + ), |
| 119 | - "Font size", | 161 | + row( |
| 120 | - segmented( | 162 | + "Font size", |
| 121 | - FontSize::ALL.map(|size| (size, size.label())), | 163 | + segmented( |
| 122 | - self.settings.font_size, | 164 | + FontSize::ALL.map(|size| (size, size.label())), |
| 123 | - entity, | 165 | + self.settings.font_size, |
| 124 | - palette, | 166 | + entity, |
| 125 | - Yumush::set_font_size, | 167 | + palette, |
| 126 | - ), | 168 | + Yumush::set_font_size, |
| 127 | ), | 169 | ), |
| 128 | - row( | 170 | + ), |
| 129 | - "Close to tray", | 171 | + row( |
| 130 | - super::parts::toggle( | 172 | + "Close to tray", |
| 131 | - "close_to_tray_switch", | 173 | + super::parts::toggle( |
| 132 | - self.settings.close_to_tray, | 174 | + "close_to_tray_switch", |
| 133 | - palette.tokens, | 175 | + self.settings.close_to_tray, |
| 134 | - { | 176 | + palette.tokens, |
| 135 | - let entity = entity.clone(); | 177 | + { |
| 136 | - move |_, cx| { | 178 | + let entity = entity.clone(); |
| 137 | - entity.update(cx, |yumush, cx| { | 179 | + move |_, cx| { |
| 138 | - yumush.settings.close_to_tray = !yumush.settings.close_to_tray; | 180 | + entity.update(cx, |yumush, cx| { |
| 139 | - yumush.commit_settings(cx); | 181 | + yumush.settings.close_to_tray = !yumush.settings.close_to_tray; |
| 140 | - }) | 182 | + yumush.commit_settings(cx); |
| 141 | - } | 183 | + }) |
| 142 | - }, | 184 | + } |
| 143 | - ), | 185 | + }, |
| 144 | ), | 186 | ), |
| 145 | - ], | 187 | + ), |
| 146 | - )); | 188 | + ]; |
| 189 | + if let Some(user) = self.user.as_ref() { | ||
| 190 | + appearance.push(row( | ||
| 191 | + "Your hue", | ||
| 192 | + hue_picker(Some(style::hue_of(user.id)), entity, palette), | ||
| 193 | + )); | ||
| 194 | + } | ||
| 195 | + sections.push(section("Appearance", palette, appearance)); | ||
| 147 | if self.user.is_some() { | 196 | if self.user.is_some() { |
| 148 | sections.push(danger_section( | 197 | sections.push(danger_section( |
| 149 | palette, | 198 | palette, |
| @@ -332,6 +381,135 @@ fn hue_picker(current: Option<Hue>, entity: &Entity<Yumush>, palette: Palette) - | |||
| 332 | })) | 381 | })) |
| 333 | } | 382 | } |
| 334 | 383 | ||
| 384 | +fn camera_share(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> AnyElement { | ||
| 385 | + div() | ||
| 386 | + .flex() | ||
| 387 | + .flex_col() | ||
| 388 | + .gap(px(space::XL)) | ||
| 389 | + .child(titled( | ||
| 390 | + "Camera", | ||
| 391 | + palette, | ||
| 392 | + rows_column(palette, camera_rows(yumush, entity, palette)), | ||
| 393 | + )) | ||
| 394 | + .child(titled( | ||
| 395 | + "Screen share", | ||
| 396 | + palette, | ||
| 397 | + rows_column(palette, screen_rows(yumush, entity, palette)), | ||
| 398 | + )) | ||
| 399 | + .into_any_element() | ||
| 400 | +} | ||
| 401 | + | ||
| 402 | +fn camera_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Vec<Div> { | ||
| 403 | + let modes = share_modes(yumush, Kind::Camera); | ||
| 404 | + let max_height = capabilities().max_height; | ||
| 405 | + let top = share::clamp(yumush.settings.share.top(Kind::Camera), &modes, max_height); | ||
| 406 | + let (resolutions, fps) = share::options(&modes, top.resolution, max_height); | ||
| 407 | + vec![ | ||
| 408 | + row( | ||
| 409 | + "Quality", | ||
| 410 | + parts::options( | ||
| 411 | + "camera_quality", | ||
| 412 | + RESOLUTIONS | ||
| 413 | + .into_iter() | ||
| 414 | + .filter(|(resolution, _)| resolutions.contains(resolution)), | ||
| 415 | + top.resolution, | ||
| 416 | + palette.tokens, | ||
| 417 | + share_pick(entity, Kind::Camera, Yumush::set_share_resolution), | ||
| 418 | + ), | ||
| 419 | + ), | ||
| 420 | + row( | ||
| 421 | + "Frame rate", | ||
| 422 | + parts::options( | ||
| 423 | + "camera_fps", | ||
| 424 | + FPS.into_iter().filter(|(value, _)| fps.contains(value)), | ||
| 425 | + top.fps, | ||
| 426 | + palette.tokens, | ||
| 427 | + share_pick(entity, Kind::Camera, Yumush::set_share_fps), | ||
| 428 | + ), | ||
| 429 | + ), | ||
| 430 | + ] | ||
| 431 | +} | ||
| 432 | + | ||
| 433 | +fn screen_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Vec<Div> { | ||
| 434 | + let settings = &yumush.settings.share; | ||
| 435 | + let modes = share_modes(yumush, Kind::Screen); | ||
| 436 | + let max_height = capabilities().max_height; | ||
| 437 | + let top = share::clamp(settings.top(Kind::Screen), &modes, max_height); | ||
| 438 | + let (resolutions, fps) = share::options(&modes, top.resolution, max_height); | ||
| 439 | + let audio_on = settings.audio != ShareAudio::Off; | ||
| 440 | + let audio_entity = entity.clone(); | ||
| 441 | + vec![ | ||
| 442 | + row( | ||
| 443 | + "Quality", | ||
| 444 | + parts::options( | ||
| 445 | + "screen_quality", | ||
| 446 | + RESOLUTIONS | ||
| 447 | + .into_iter() | ||
| 448 | + .filter(|(resolution, _)| resolutions.contains(resolution)), | ||
| 449 | + top.resolution, | ||
| 450 | + palette.tokens, | ||
| 451 | + share_pick(entity, Kind::Screen, Yumush::set_share_resolution), | ||
| 452 | + ), | ||
| 453 | + ), | ||
| 454 | + row( | ||
| 455 | + "Frame rate", | ||
| 456 | + parts::options( | ||
| 457 | + "screen_fps", | ||
| 458 | + FPS.into_iter().filter(|(value, _)| fps.contains(value)), | ||
| 459 | + top.fps, | ||
| 460 | + palette.tokens, | ||
| 461 | + share_pick(entity, Kind::Screen, Yumush::set_share_fps), | ||
| 462 | + ), | ||
| 463 | + ), | ||
| 464 | + row( | ||
| 465 | + "Codec", | ||
| 466 | + parts::options( | ||
| 467 | + "share_codec", | ||
| 468 | + CODECS.into_iter().filter(|(codec, _)| match codec { | ||
| 469 | + ShareCodec::Auto => true, | ||
| 470 | + ShareCodec::Only(codec) => capabilities().encode.contains(codec), | ||
| 471 | + }), | ||
| 472 | + settings.codec, | ||
| 473 | + palette.tokens, | ||
| 474 | + share_pick(entity, Kind::Screen, Yumush::set_share_codec), | ||
| 475 | + ), | ||
| 476 | + ), | ||
| 477 | + row( | ||
| 478 | + "Share audio", | ||
| 479 | + parts::toggle( | ||
| 480 | + "share_audio_switch", | ||
| 481 | + audio_on, | ||
| 482 | + palette.tokens, | ||
| 483 | + move |_, cx| { | ||
| 484 | + audio_entity.update(cx, |yumush, cx| { | ||
| 485 | + let mode = if audio_on { | ||
| 486 | + AudioMode::Off | ||
| 487 | + } else { | ||
| 488 | + AudioMode::Everything | ||
| 489 | + }; | ||
| 490 | + yumush.set_share_audio_mode(mode, cx) | ||
| 491 | + }) | ||
| 492 | + }, | ||
| 493 | + ), | ||
| 494 | + ), | ||
| 495 | + ] | ||
| 496 | +} | ||
| 497 | + | ||
| 498 | +fn share_pick<T: Copy + 'static>( | ||
| 499 | + entity: &Entity<Yumush>, | ||
| 500 | + kind: Kind, | ||
| 501 | + set: fn(&mut Yumush, T, &mut Context<Yumush>), | ||
| 502 | +) -> impl Fn(T, &mut Window, &mut App) + Clone + 'static { | ||
| 503 | + let entity = entity.clone(); | ||
| 504 | + move |value, _, cx| { | ||
| 505 | + entity.update(cx, |yumush, cx| { | ||
| 506 | + let tab = std::mem::replace(&mut yumush.share_tab, kind); | ||
| 507 | + set(yumush, value, cx); | ||
| 508 | + yumush.share_tab = tab; | ||
| 509 | + }) | ||
| 510 | + } | ||
| 511 | +} | ||
| 512 | + | ||
| 335 | pub(super) fn picked_avatar( | 513 | pub(super) fn picked_avatar( |
| 336 | cx: &App, | 514 | cx: &App, |
| 337 | maximum: u64, | 515 | maximum: u64, |
| @@ -469,6 +647,14 @@ pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> Section { | |||
| 469 | Section("Danger zone", rows_column(palette, rows)) | 647 | Section("Danger zone", rows_column(palette, rows)) |
| 470 | } | 648 | } |
| 471 | 649 | ||
| 650 | +fn titled(title: &'static str, palette: Palette, rows: impl IntoElement) -> Div { | ||
| 651 | + div() | ||
| 652 | + .flex() | ||
| 653 | + .flex_col() | ||
| 654 | + .child(parts::section(title, palette.tokens)) | ||
| 655 | + .child(rows) | ||
| 656 | +} | ||
| 657 | + | ||
| 472 | fn rows_column(palette: Palette, rows: Vec<Div>) -> AnyElement { | 658 | fn rows_column(palette: Palette, rows: Vec<Div>) -> AnyElement { |
| 473 | div() | 659 | div() |
| 474 | .flex() | 660 | .flex() |
crates/client/src/gui/share_view.rsmodified+4 -4
| @@ -56,7 +56,7 @@ const BAR_TTL: Duration = Duration::from_millis(2500); | |||
| 56 | const APPS_REFRESH: Duration = Duration::from_secs(2); | 56 | const APPS_REFRESH: Duration = Duration::from_secs(2); |
| 57 | const APPS_IDLE: Duration = Duration::from_secs(5); | 57 | const APPS_IDLE: Duration = Duration::from_secs(5); |
| 58 | 58 | ||
| 59 | -const RESOLUTIONS: [(Resolution, &str); 6] = [ | 59 | +pub(super) const RESOLUTIONS: [(Resolution, &str); 6] = [ |
| 60 | (Resolution::P360, "360"), | 60 | (Resolution::P360, "360"), |
| 61 | (Resolution::P480, "480"), | 61 | (Resolution::P480, "480"), |
| 62 | (Resolution::P720, "720"), | 62 | (Resolution::P720, "720"), |
| @@ -64,9 +64,9 @@ const RESOLUTIONS: [(Resolution, &str); 6] = [ | |||
| 64 | (Resolution::P1440, "1440"), | 64 | (Resolution::P1440, "1440"), |
| 65 | (Resolution::P2160, "2160"), | 65 | (Resolution::P2160, "2160"), |
| 66 | ]; | 66 | ]; |
| 67 | -const FPS: [(Fps, &str); 3] = [(Fps::F15, "15"), (Fps::F30, "30"), (Fps::F60, "60")]; | 67 | +pub(super) const FPS: [(Fps, &str); 3] = [(Fps::F15, "15"), (Fps::F30, "30"), (Fps::F60, "60")]; |
| 68 | 68 | ||
| 69 | -const CODECS: [(ShareCodec, &str); 4] = [ | 69 | +pub(super) const CODECS: [(ShareCodec, &str); 4] = [ |
| 70 | (ShareCodec::Auto, "Auto"), | 70 | (ShareCodec::Auto, "Auto"), |
| 71 | (ShareCodec::Only(Codec::Av1), "AV1"), | 71 | (ShareCodec::Only(Codec::Av1), "AV1"), |
| 72 | (ShareCodec::Only(Codec::H265), "H265"), | 72 | (ShareCodec::Only(Codec::H265), "H265"), |
| @@ -795,7 +795,7 @@ fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> | |||
| 795 | }) | 795 | }) |
| 796 | } | 796 | } |
| 797 | 797 | ||
| 798 | -fn share_modes(yumush: &Yumush, kind: Kind) -> Vec<Mode> { | 798 | +pub(super) fn share_modes(yumush: &Yumush, kind: Kind) -> Vec<Mode> { |
| 799 | yumush | 799 | yumush |
| 800 | .network | 800 | .network |
| 801 | .share_modes(kind) | 801 | .share_modes(kind) |
crates/client/src/gui/sidebar.rsmodified+15 -43
| @@ -187,12 +187,14 @@ impl Yumush { | |||
| 187 | .flex() | 187 | .flex() |
| 188 | .items_center() | 188 | .items_center() |
| 189 | .gap(px(space::XS)) | 189 | .gap(px(space::XS)) |
| 190 | - .child( | 190 | + .when(self.chat.voice_community() != Some(community_id), |this| { |
| 191 | - div() | 191 | + this.child( |
| 192 | - .w(px(size::CONTROL)) | 192 | + div() |
| 193 | - .h(px(space::MD)) | 193 | + .w(px(size::CONTROL)) |
| 194 | - .child(super::parts::voice_line(wave, voice, palette.tokens)), | 194 | + .h(px(space::MD)) |
| 195 | - ) | 195 | + .child(super::parts::voice_line(wave, voice, palette.tokens)), |
| 196 | + ) | ||
| 197 | + }) | ||
| 196 | .child( | 198 | .child( |
| 197 | div() | 199 | div() |
| 198 | .text_size(text(text::CAPTION)) | 200 | .text_size(text(text::CAPTION)) |
| @@ -242,11 +244,6 @@ impl Yumush { | |||
| 242 | let speaking = self.chat.waves.speaking.contains(&user_id); | 244 | let speaking = self.chat.waves.speaking.contains(&user_id); |
| 243 | let shown = speaking || (me && !muted); | 245 | let shown = speaking || (me && !muted); |
| 244 | let wave = shown.then(|| self.chat.waves.voice(user_id)).flatten(); | 246 | let wave = shown.then(|| self.chat.waves.voice(user_id)).flatten(); |
| 245 | - let voice = if wave.is_some() { | ||
| 246 | - super::parts::Voice::Live(palette.tinted(user_id)) | ||
| 247 | - } else { | ||
| 248 | - super::parts::Voice::Quiet | ||
| 249 | - }; | ||
| 250 | let camera = self | 247 | let camera = self |
| 251 | .chat | 248 | .chat |
| 252 | .share_of(community_id, user_id, Kind::Camera) | 249 | .share_of(community_id, user_id, Kind::Camera) |
| @@ -277,13 +274,6 @@ impl Yumush { | |||
| 277 | .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD)) | 274 | .when(speaking, |name| name.font_weight(FontWeight::SEMIBOLD)) |
| 278 | .child(user.username.clone()), | 275 | .child(user.username.clone()), |
| 279 | ) | 276 | ) |
| 280 | - .child( | ||
| 281 | - div() | ||
| 282 | - .w(px(size::CONTROL)) | ||
| 283 | - .h(px(space::MD)) | ||
| 284 | - .flex_none() | ||
| 285 | - .child(super::parts::voice_line(wave, voice, palette.tokens)), | ||
| 286 | - ) | ||
| 287 | .children((muted && wave.is_none()).then(|| { | 277 | .children((muted && wave.is_none()).then(|| { |
| 288 | Icon::new(IconName::MicOff) | 278 | Icon::new(IconName::MicOff) |
| 289 | .size(px(size::ICON_SM)) | 279 | .size(px(size::ICON_SM)) |
| @@ -942,13 +932,6 @@ impl Yumush { | |||
| 942 | named: bool, | 932 | named: bool, |
| 943 | palette: Palette, | 933 | palette: Palette, |
| 944 | ) -> impl IntoElement { | 934 | ) -> impl IntoElement { |
| 945 | - let speaking = self.chat.waves.speaking.contains(&user.id); | ||
| 946 | - let own_wave = self.chat.waves.voice(user.id); | ||
| 947 | - let own_voice = if speaking { | ||
| 948 | - super::parts::Voice::Live(palette.tokens.person(user.id)) | ||
| 949 | - } else { | ||
| 950 | - super::parts::Voice::Quiet | ||
| 951 | - }; | ||
| 952 | profile_popover( | 935 | profile_popover( |
| 953 | "account_profile", | 936 | "account_profile", |
| 954 | Anchor::BottomLeft, | 937 | Anchor::BottomLeft, |
| @@ -978,24 +961,13 @@ impl Yumush { | |||
| 978 | )) | 961 | )) |
| 979 | }) | 962 | }) |
| 980 | .when(named, |trigger| { | 963 | .when(named, |trigger| { |
| 981 | - trigger | 964 | + trigger.child( |
| 982 | - .child( | 965 | + div() |
| 983 | - div() | 966 | + .min_w_0() |
| 984 | - .min_w_0() | 967 | + .truncate() |
| 985 | - .truncate() | 968 | + .text_color(palette.muted) |
| 986 | - .text_color(palette.muted) | 969 | + .child(user.username.clone()), |
| 987 | - .child(user.username.clone()), | 970 | + ) |
| 988 | - ) | ||
| 989 | - .child( | ||
| 990 | - div() | ||
| 991 | - .w(px(size::CONTROL + space::LG)) | ||
| 992 | - .h(px(space::MD)) | ||
| 993 | - .child(super::parts::voice_line( | ||
| 994 | - own_wave, | ||
| 995 | - own_voice, | ||
| 996 | - palette.tokens, | ||
| 997 | - )), | ||
| 998 | - ) | ||
| 999 | }), | 971 | }), |
| 1000 | palette, | 972 | palette, |
| 1001 | ), | 973 | ), |