forge
Explore
Log in

Don't you dare go Hollow

Stream name sits above strip and grid tiles with kind icon, person colour while audible

Browse files at this commit

dd93b6cd85e8b686433e4ed2911e050d8e494c88Ahmet Kaan GümüşParent: 8fa2301
  • style
    • stream name sits above strip and grid tiles with kind icon, person colour while audible
    • share pill line only on real share audio (Waves::share_audible)
    • friends icon Users
Show full message
💄 style: stream name sits above strip and grid tiles with kind icon, person colour while audible; share pill line only on real share audio (Waves::share_audible); friends icon Users
crates/client/src/gui/camera_view.rsmodified+31 -30
@@ -427,17 +427,12 @@ fn stage_tile(
427427 let t = palette.tokens;
428428 let entity = entity.clone();
429429 let focused = yumush.is_watching(user_id, kind);
430- let speaking = yumush.chat.waves.speaking.contains(&user_id);
431430 let surface = yumush
432431 .chat
433432 .tiles
434433 .get(&(user_id, kind))
435434 .filter(|tile| tile.shown)
436435 .map(|tile| tile.surface.clone());
437- let name = yumush
438- .chat
439- .author(user_id)
440- .map_or_else(|| user_id.to_string(), |user| user.username.clone());
441436
442437 div()
443438 .id(format!("stage_{user_id}_{kind:?}"))
@@ -453,6 +448,7 @@ fn stage_tile(
453448 yumush.toggle_viewer(user_id, kind, window, cx)
454449 });
455450 })
451+ .child(tile_name(yumush, (user_id, kind), focused, t))
456452 .child(
457453 div()
458454 .h(px(TILE_H))
@@ -461,15 +457,6 @@ fn stage_tile(
461457 .bg(t.raise())
462458 .children(surface),
463459 )
464- .child(tile_name(
465- name,
466- if speaking || focused {
467- Ink::Paper
468- } else {
469- Ink::Dim
470- },
471- t,
472- ))
473460 }
474461
475462 fn more_tile(entity: &Entity<Yumush>, more: usize, palette: Palette) -> impl IntoElement {
@@ -520,12 +507,6 @@ fn grid_cell(
520507 .get(&(user_id, kind))
521508 .filter(|tile| tile.shown)
522509 .map(|tile| tile.surface.clone());
523- let speaking = yumush.chat.waves.speaking.contains(&user_id);
524- let name = yumush
525- .chat
526- .author(user_id)
527- .map_or_else(|| user_id.to_string(), |user| user.username.clone());
528-
529510 div()
530511 .id(format!("grid_{user_id}_{kind:?}"))
531512 .flex_1()
@@ -541,6 +522,7 @@ fn grid_cell(
541522 yumush.toggle_viewer(user_id, kind, window, cx)
542523 });
543524 })
525+ .child(tile_name(yumush, (user_id, kind), false, t))
544526 .child(
545527 div()
546528 .flex_1()
@@ -550,11 +532,6 @@ fn grid_cell(
550532 .bg(t.raise())
551533 .children(surface),
552534 )
553- .child(tile_name(
554- name,
555- if speaking { Ink::Paper } else { Ink::Dim },
556- t,
557- ))
558535 .into_any_element()
559536 }
560537
@@ -577,10 +554,34 @@ pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, K
577554 .children(muted.then(|| super::parts::small_icon(IconName::MicOff).text_color(t.bad())))
578555 }
579556
580-fn tile_name(name: impl Into<gpui_kit::SharedString>, ink: Ink, t: super::style::Tokens) -> Div {
581- div()
557+fn tile_name(
558+ yumush: &Yumush,
559+ (user_id, kind): (Id, Kind),
560+ focused: bool,
561+ t: super::style::Tokens,
562+) -> Div {
563+ let name = yumush
564+ .chat
565+ .author(user_id)
566+ .map_or_else(|| user_id.to_string(), |user| user.username.clone());
567+ let audible = yumush.chat.waves.audible(user_id);
568+ let ink = if audible || focused {
569+ Ink::Paper
570+ } else {
571+ Ink::Dim
572+ };
573+ super::parts::band(space::XS)
582574 .h(px(size::ICON))
583- .flex()
584- .items_center()
585- .child(words(name, Text::Label, ink, t))
575+ .child(
576+ super::parts::small_icon(match kind {
577+ Kind::Camera => IconName::Video,
578+ Kind::Screen => IconName::ScreenShare,
579+ })
580+ .text_color(if audible { t.person(user_id) } else { t.dim() }),
581+ )
582+ .child(
583+ words(name, Text::Label, ink, t)
584+ .truncate()
585+ .when(audible, |name| name.text_color(t.person(user_id))),
586+ )
586587 }
crates/client/src/gui/chat.rsmodified+1 -1
@@ -3005,7 +3005,7 @@ fn members_column(
30053005 user.id,
30063006 kind,
30073007 yumush.is_watching(user.id, kind),
3008- (kind == Kind::Screen)
3008+ (kind == Kind::Screen && chat.waves.share_audible(user.id))
30093009 .then(|| chat.waves.share(user.id))
30103010 .flatten(),
30113011 palette,
crates/client/src/gui/sidebar.rsmodified+1 -1
@@ -398,7 +398,7 @@ impl Yumush {
398398 .justify_center()
399399 .rounded_full()
400400 .text_color(palette.muted)
401- .child(super::parts::small_icon(IconName::UserRoundCheck))
401+ .child(super::parts::small_icon(IconName::Users))
402402 .children(alert.then(|| {
403403 div()
404404 .absolute()
crates/client/src/gui/wave.rsmodified+7 -1
@@ -139,7 +139,13 @@ impl Waves {
139139 }
140140
141141 pub fn audible(&self, id: Id) -> bool {
142- self.speaking.contains(&id) || self.share.contains_key(&id)
142+ self.speaking.contains(&id) || self.share_audible(id)
143+ }
144+
145+ pub fn share_audible(&self, id: Id) -> bool {
146+ self.share
147+ .get(&id)
148+ .is_some_and(|wave| wave.bars.iter().any(|bar| *bar >= GONE))
143149 }
144150
145151 pub fn share(&self, id: Id) -> Option<&VecDeque<f32>> {