forge
Explore
Log in

Don't you dare go Hollow

Speaker slots (six voice lines, speakers take a slot, 'N more')

Browse files at this commit

155ff774d419b8118e81b22836cc0b4404591ee4Ahmet Kaan GümüşParent: 6d42b44
  • feat
    • speaker slots (six voice lines, speakers take a slot, 'N more')
    • screens strip of captioned thumbnails with a '+N screens' tile into the grid
    • rooms with unread first
    • colour only on people (speaking edges in their hue, call log and toggles in ink)
Show full message
✨ feat: speaker slots (six voice lines, speakers take a slot, 'N more'); screens strip of captioned thumbnails with a '+N screens' tile into the grid; rooms with unread first; colour only on people (speaking edges in their hue, call log and toggles in ink)
crates/client/src/gui/camera_view.rsmodified+110 -68
@@ -10,7 +10,7 @@ use gpui_kit::{
10 };10 };
11 11
12 use super::{12 use super::{
13- Palette, Tooltip as _, Yumush, avatar, clickable,13+ Palette, Tooltip as _, Yumush, avatar,
14 media_view::into_render_image,14 media_view::into_render_image,
15 notify_error,15 notify_error,
16 parts::{Ink, Text, Voice, caption, scrim, voice_line, words},16 parts::{Ink, Text, Voice, caption, scrim, voice_line, words},
@@ -21,12 +21,13 @@ use super::{
21 };21 };
22 use crate::share::session::WatchQuality;22 use crate::share::session::WatchQuality;
23 23
24+const SLOTS: usize = 6;
24 const IDLE_TICK: Duration = Duration::from_millis(250);25 const IDLE_TICK: Duration = Duration::from_millis(250);
25 const FRAME_TICK: Duration = Duration::from_millis(16);26 const FRAME_TICK: Duration = Duration::from_millis(16);
26 const PUMP_STALL: Duration = Duration::from_millis(50);27 const PUMP_STALL: Duration = Duration::from_millis(50);
27-const STRIP_H: f32 = 206.;28+const STRIP_MAX: usize = 5;
28-const TILE_W: f32 = 338.;29+const TILE_W: f32 = size::THUMB * 1.5;
29-const TILE_H: f32 = 190.;30+const TILE_H: f32 = TILE_W * 9. / 16.;
30 31
31 pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality {32 pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality {
32 resolution: Resolution::P360,33 resolution: Resolution::P360,
@@ -219,22 +220,23 @@ impl Yumush {
219 if !shown || !self.in_stage_chat() {220 if !shown || !self.in_stage_chat() {
220 return None;221 return None;
221 }222 }
222- let tiles: Vec<_> = self223+ let sources = self.stage_sources();
223- .stage_sources()224+ let more = sources.len().saturating_sub(STRIP_MAX);
224- .into_iter()225+ let strip = (!sources.is_empty()).then(|| {
225- .map(|source| stage_tile(entity, self, palette, source))
226- .collect();
227- let strip = (!tiles.is_empty()).then(|| {
228 div()226 div()
229 .id("stage_strip")227 .id("stage_strip")
230 .flex()228 .flex()
231 .flex_shrink_0()229 .flex_shrink_0()
232- .h(px(STRIP_H))230+ .gap(px(space::LG))
233- .gap(px(space::SM))
234 .px(px(space::XL))231 .px(px(space::XL))
235- .pb(px(space::SM))232+ .pb(px(space::LG))
236- .overflow_x_scroll()233+ .children(
237- .children(tiles)234+ sources
235+ .into_iter()
236+ .take(STRIP_MAX)
237+ .map(|source| stage_tile(entity, self, palette, source).into_any_element()),
238+ )
239+ .children((more > 0).then(|| more_tile(entity, more, palette).into_any_element()))
238 });240 });
239 241
240 Some(242 Some(
@@ -249,16 +251,31 @@ impl Yumush {
249 251
250 fn voices(&self, palette: Palette) -> Div {252 fn voices(&self, palette: Palette) -> Div {
251 let t = palette.tokens;253 let t = palette.tokens;
252- let people = self254+ let ids = self
253 .chat255 .chat
254 .voice_community()256 .voice_community()
255 .map(|community_id| self.chat.voice_ids(community_id))257 .map(|community_id| self.chat.voice_ids(community_id))
256- .unwrap_or_default()258+ .unwrap_or_default();
259+ let speaking = |id: &Id| self.chat.waves.speaking.contains(id);
260+ let mut shown: Vec<Id> = ids
257 .iter()261 .iter()
258- .filter_map(|id| self.chat.author(*id))262+ .filter(|id| speaking(id))
263+ .take(SLOTS)
264+ .copied()
265+ .collect();
266+ shown.extend(
267+ ids.iter()
268+ .filter(|id| !speaking(id))
269+ .take(SLOTS - shown.len())
270+ .copied(),
271+ );
272+ shown.sort_by_key(|id| ids.iter().position(|other| other == id));
273+ let more = ids.len() - shown.len();
274+ let people = shown
275+ .into_iter()
276+ .filter_map(|id| self.chat.author(id))
259 .map(|user| {277 .map(|user| {
260- let speaking = self.chat.waves.speaking.contains(&user.id);278+ let voice = if speaking(&user.id) {
261- let voice = if speaking {
262 Voice::Live(t.person(user.id))279 Voice::Live(t.person(user.id))
263 } else {280 } else {
264 Voice::Quiet281 Voice::Quiet
@@ -278,6 +295,9 @@ impl Yumush {
278 .px(px(space::XL))295 .px(px(space::XL))
279 .py(px(space::XL))296 .py(px(space::XL))
280 .children(people)297 .children(people)
298+ .children((more > 0).then(|| {
299+ caption(format!("{more} more"), voice_line(None, Voice::Quiet, t), t).w_full()
300+ }))
281 }301 }
282 302
283 pub(super) fn stage_grid(303 pub(super) fn stage_grid(
@@ -396,6 +416,7 @@ fn stage_tile(
396 palette: Palette,416 palette: Palette,
397 (user_id, kind): (Id, Kind),417 (user_id, kind): (Id, Kind),
398 ) -> impl IntoElement {418 ) -> impl IntoElement {
419+ let t = palette.tokens;
399 let entity = entity.clone();420 let entity = entity.clone();
400 let focused = yumush.is_watching(user_id, kind);421 let focused = yumush.is_watching(user_id, kind);
401 let speaking = yumush.chat.waves.speaking.contains(&user_id);422 let speaking = yumush.chat.waves.speaking.contains(&user_id);
@@ -405,57 +426,78 @@ fn stage_tile(
405 .get(&(user_id, kind))426 .get(&(user_id, kind))
406 .filter(|tile| tile.shown)427 .filter(|tile| tile.shown)
407 .map(|tile| tile.surface.clone());428 .map(|tile| tile.surface.clone());
408- let user = yumush.chat.author(user_id);429+ let name = yumush
409- let content = match (surface, user) {430+ .chat
410- (Some(surface), _) => surface.into_any_element(),431+ .author(user_id)
411- (None, Some(user)) => div()432+ .map_or_else(|| user_id.to_string(), |user| user.username.clone());
412- .size_full()
413- .flex()
414- .items_center()
415- .justify_center()
416- .child(avatar(
417- palette,
418- user,
419- px(size::AVATAR_LG),
420- text(text::TITLE),
421- &yumush.chat.avatars,
422- ))
423- .into_any_element(),
424- (None, None) => div().into_any_element(),
425- };
426 433
427- clickable(434+ div()
428- format!("stage_{user_id}_{kind:?}"),435+ .id(format!("stage_{user_id}_{kind:?}"))
429- palette,436+ .tip("Watch")
430- move |window, cx| {437+ .cursor_pointer()
438+ .flex()
439+ .flex_col()
440+ .flex_shrink_0()
441+ .gap(px(space::SM))
442+ .w(px(TILE_W))
443+ .on_click(move |_, window, cx| {
431 entity.update(cx, |yumush, cx| {444 entity.update(cx, |yumush, cx| {
432 yumush.toggle_viewer(user_id, kind, window, cx)445 yumush.toggle_viewer(user_id, kind, window, cx)
433 });446 });
434- },447+ })
435- )448+ .child(
436- .tip("Watch")449+ div()
437- .relative()450+ .h(px(TILE_H))
438- .flex_shrink_0()451+ .rounded(px(radius::MD))
439- .w(px(TILE_W))452+ .overflow_hidden()
440- .h(px(TILE_H))453+ .bg(t.raise())
441- .rounded(px(radius::MD))454+ .children(surface),
442- .overflow_hidden()455+ )
443- .bg(gpui_kit::black())456+ .child(caption(
444- .border_2()457+ name,
445- .border_color(if focused {458+ voice_line(
446- palette.accent459+ yumush.chat.waves.voice(user_id),
447- } else if speaking {460+ if speaking {
448- palette.ok461+ Voice::Live(t.person(user_id))
449- } else {462+ } else if focused {
450- transparent_black()463+ Voice::Live(t.paper())
451- })464+ } else {
452- .child(content)465+ Voice::Quiet
453- .child(466+ },
454- tile_label(yumush, palette, (user_id, kind))467+ t,
455- .absolute()468+ ),
456- .left(px(space::SM))469+ t,
457- .bottom(px(space::SM)),470+ ))
458- )471+}
472+
473+fn more_tile(entity: &Entity<Yumush>, more: usize, palette: Palette) -> impl IntoElement {
474+ let t = palette.tokens;
475+ let entity = entity.clone();
476+ div()
477+ .id("stage_more")
478+ .cursor_pointer()
479+ .flex()
480+ .flex_col()
481+ .flex_shrink_0()
482+ .gap(px(space::SM))
483+ .w(px(TILE_W))
484+ .on_click(move |_, _, cx| {
485+ entity.update(cx, |yumush, cx| {
486+ yumush.close_viewer(cx);
487+ yumush.set_stage(Stage::Grid, cx);
488+ });
489+ })
490+ .child(
491+ div()
492+ .h(px(TILE_H))
493+ .flex()
494+ .items_center()
495+ .justify_center()
496+ .rounded(px(radius::MD))
497+ .bg(t.raise())
498+ .child(words(format!("+{more}"), Text::Title, Ink::Paper, t)),
499+ )
500+ .child(caption("screens", voice_line(None, Voice::Quiet, t), t))
459 }501 }
460 502
461 fn grid_cell(503 fn grid_cell(
@@ -502,7 +544,7 @@ fn grid_cell(
502 .bg(gpui_kit::black())544 .bg(gpui_kit::black())
503 .border_2()545 .border_2()
504 .border_color(if speaking {546 .border_color(if speaking {
505- palette.ok547+ palette.tokens.person(user_id)
506 } else {548 } else {
507 transparent_black()549 transparent_black()
508 })550 })
crates/client/src/gui/chat.rsmodified+2 -2
@@ -2852,7 +2852,7 @@ fn render_call(
2852 .map_or("unknown", |user| user.username.as_str());2852 .map_or("unknown", |user| user.username.as_str());
2853 let who = if mine { "You" } else { author };2853 let who = if mine { "You" } else { author };
2854 let (icon, color) = match call {2854 let (icon, color) = match call {
2855- CallLog::Started | CallLog::Ended { .. } => (IconName::Phone, palette.ok),2855+ CallLog::Started | CallLog::Ended { .. } => (IconName::Phone, palette.muted),
2856 CallLog::Declined => (IconName::PhoneOff, palette.danger),2856 CallLog::Declined => (IconName::PhoneOff, palette.danger),
2857 CallLog::Missed => (IconName::PhoneMissed, palette.danger),2857 CallLog::Missed => (IconName::PhoneMissed, palette.danger),
2858 };2858 };
@@ -3138,7 +3138,7 @@ fn stats_button(entity: &Entity<Yumush>, palette: Palette, open: bool) -> impl I
3138 .justify_center()3138 .justify_center()
3139 .rounded(px(radius::MD))3139 .rounded(px(radius::MD))
3140 .when(open, |this| this.bg(palette.tokens.press()))3140 .when(open, |this| this.bg(palette.tokens.press()))
3141- .text_color(if open { palette.ok } else { palette.muted })3141+ .text_color(if open { palette.text } else { palette.muted })
3142 .child(Icon::new(IconName::Activity).size(px(size::ICON_SM)))3142 .child(Icon::new(IconName::Activity).size(px(size::ICON_SM)))
3143 }3143 }
3144 3144
crates/client/src/gui/share_view.rsmodified+1 -1
@@ -935,6 +935,6 @@ fn pick_row(
935 Icon::new(IconName::Check)935 Icon::new(IconName::Check)
936 .size(px(size::ICON_SM))936 .size(px(size::ICON_SM))
937 .flex_shrink_0()937 .flex_shrink_0()
938- .text_color(palette.ok)938+ .text_color(palette.text)
939 }))939 }))
940 }940 }
crates/client/src/gui/sidebar.rsmodified+59 -44
@@ -340,7 +340,7 @@ impl Yumush {
340 .child(340 .child(
341 Icon::new(IconName::AudioLines)341 Icon::new(IconName::AudioLines)
342 .size(px(size::ICON_SM))342 .size(px(size::ICON_SM))
343- .text_color(palette.ok),343+ .text_color(palette.text),
344 ),344 ),
345 )345 )
346 }346 }
@@ -476,30 +476,33 @@ impl Yumush {
476 476
477 fn communities_list(&self, entity: &Entity<Self>, palette: Palette) -> Div {477 fn communities_list(&self, entity: &Entity<Self>, palette: Palette) -> Div {
478 div().flex().flex_col().gap(px(space::XXS)).children(478 div().flex().flex_col().gap(px(space::XXS)).children(
479- self.chat479+ self.unread_first(
480- .communities480+ self.chat
481- .iter()481+ .communities
482- .chain(self.chat.opened.as_ref())482+ .iter()
483- .filter(|community| matches!(community.kind, CommunityKind::Group))483+ .chain(self.chat.opened.as_ref())
484- .map(|community| {484+ .filter(|community| matches!(community.kind, CommunityKind::Group)),
485- let active = self.chat.is_selected(community.id);485+ )
486- let muted = self.chat.muted.contains(&community.id);486+ .into_iter()
487- let can_leave = !active || permission::can_leave(self.actor_rank());487+ .map(|community| {
488-488+ let active = self.chat.is_selected(community.id);
489- let row = self.sidebar_community_row(489+ let muted = self.chat.muted.contains(&community.id);
490- entity,490+ let can_leave = !active || permission::can_leave(self.actor_rank());
491- community,491+
492- palette,492+ let row = self.sidebar_community_row(
493- "community",493+ entity,
494- community_menu(entity, community.id, can_leave, muted),494+ community,
495- );495+ palette,
496- div()496+ "community",
497- .flex()497+ community_menu(entity, community.id, can_leave, muted),
498- .flex_col()498+ );
499- .child(row)499+ div()
500- .children(self.call_tree(entity, community.id, palette))500+ .flex()
501- .into_any_element()501+ .flex_col()
502- }),502+ .child(row)
503+ .children(self.call_tree(entity, community.id, palette))
504+ .into_any_element()
505+ }),
503 )506 )
504 }507 }
505 508
@@ -574,26 +577,38 @@ impl Yumush {
574 group("Requests", palette, rows)577 group("Requests", palette, rows)
575 }578 }
576 579
577- fn direct_rows(&self, entity: &Entity<Self>, query: &str, palette: Palette) -> Vec<AnyElement> {580+ fn unread_first<'a>(&self, rooms: impl Iterator<Item = &'a Community>) -> Vec<&'a Community> {
578- self.chat581+ let mut rooms: Vec<&Community> = rooms.collect();
579- .communities582+ rooms.sort_by_key(|community| {
580- .iter()583+ self.chat
581- .filter(|community| community.kind.is_direct())584+ .unread
582- .filter(|community| matches_query(community_name(community), query))585+ .get(&community.id)
583- .map(|community| {586+ .map_or((true, true), |unread| {
584- let muted = self.chat.muted.contains(&community.id);587+ (unread.mentions == 0, unread.messages == 0)
585- let menu_entity = entity.clone();588+ })
586- let menu_id = community.id;589+ });
590+ rooms
591+ }
587 592
588- self.sidebar_community_row(593+ fn direct_rows(&self, entity: &Entity<Self>, query: &str, palette: Palette) -> Vec<AnyElement> {
589- entity,594+ self.unread_first(
590- community,595+ self.chat
591- palette,596+ .communities
592- "direct",597+ .iter()
593- move |menu, _, _| mute_item(menu, &menu_entity, menu_id, muted),598+ .filter(|community| community.kind.is_direct())
594- )599+ .filter(|community| matches_query(community_name(community), query)),
600+ )
601+ .into_iter()
602+ .map(|community| {
603+ let muted = self.chat.muted.contains(&community.id);
604+ let menu_entity = entity.clone();
605+ let menu_id = community.id;
606+
607+ self.sidebar_community_row(entity, community, palette, "direct", move |menu, _, _| {
608+ mute_item(menu, &menu_entity, menu_id, muted)
595 })609 })
596- .collect()610+ })
611+ .collect()
597 }612 }
598 613
599 fn friend_rows(&self, entity: &Entity<Self>, query: &str, palette: Palette) -> Vec<AnyElement> {614 fn friend_rows(&self, entity: &Entity<Self>, query: &str, palette: Palette) -> Vec<AnyElement> {
@@ -937,7 +952,7 @@ fn watch_pill(
937 palette.muted952 palette.muted
938 }),953 }),
939 )954 )
940- .children(wave.map(|history| mini_wave(history, 10., palette.screen)))955+ .children(wave.map(|history| mini_wave(history, 10., palette.text)))
941 }956 }
942 957
943 pub(super) fn unread_badge(958 pub(super) fn unread_badge(
crates/client/src/gui/voice_settings.rsmodified+1 -1
@@ -193,7 +193,7 @@ fn level_bar(level: Option<f32>, threshold: f32, palette: Palette) -> Div {
193 ((db - range.start()) / (range.end() - range.start())).clamp(0.0, 1.0)193 ((db - range.start()) / (range.end() - range.start())).clamp(0.0, 1.0)
194 });194 });
195 let color = if level.is_some_and(|db| db >= threshold) {195 let color = if level.is_some_and(|db| db >= threshold) {
196- palette.ok196+ palette.text
197 } else {197 } else {
198 palette.muted198 palette.muted
199 };199 };