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(
427 let t = palette.tokens;427 let t = palette.tokens;
428 let entity = entity.clone();428 let entity = entity.clone();
429 let focused = yumush.is_watching(user_id, kind);429 let focused = yumush.is_watching(user_id, kind);
430- let speaking = yumush.chat.waves.speaking.contains(&user_id);
431 let surface = yumush430 let surface = yumush
432 .chat431 .chat
433 .tiles432 .tiles
434 .get(&(user_id, kind))433 .get(&(user_id, kind))
435 .filter(|tile| tile.shown)434 .filter(|tile| tile.shown)
436 .map(|tile| tile.surface.clone());435 .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());
441 436
442 div()437 div()
443 .id(format!("stage_{user_id}_{kind:?}"))438 .id(format!("stage_{user_id}_{kind:?}"))
@@ -453,6 +448,7 @@ fn stage_tile(
453 yumush.toggle_viewer(user_id, kind, window, cx)448 yumush.toggle_viewer(user_id, kind, window, cx)
454 });449 });
455 })450 })
451+ .child(tile_name(yumush, (user_id, kind), focused, t))
456 .child(452 .child(
457 div()453 div()
458 .h(px(TILE_H))454 .h(px(TILE_H))
@@ -461,15 +457,6 @@ fn stage_tile(
461 .bg(t.raise())457 .bg(t.raise())
462 .children(surface),458 .children(surface),
463 )459 )
464- .child(tile_name(
465- name,
466- if speaking || focused {
467- Ink::Paper
468- } else {
469- Ink::Dim
470- },
471- t,
472- ))
473 }460 }
474 461
475 fn more_tile(entity: &Entity<Yumush>, more: usize, palette: Palette) -> impl IntoElement {462 fn more_tile(entity: &Entity<Yumush>, more: usize, palette: Palette) -> impl IntoElement {
@@ -520,12 +507,6 @@ fn grid_cell(
520 .get(&(user_id, kind))507 .get(&(user_id, kind))
521 .filter(|tile| tile.shown)508 .filter(|tile| tile.shown)
522 .map(|tile| tile.surface.clone());509 .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-
529 div()510 div()
530 .id(format!("grid_{user_id}_{kind:?}"))511 .id(format!("grid_{user_id}_{kind:?}"))
531 .flex_1()512 .flex_1()
@@ -541,6 +522,7 @@ fn grid_cell(
541 yumush.toggle_viewer(user_id, kind, window, cx)522 yumush.toggle_viewer(user_id, kind, window, cx)
542 });523 });
543 })524 })
525+ .child(tile_name(yumush, (user_id, kind), false, t))
544 .child(526 .child(
545 div()527 div()
546 .flex_1()528 .flex_1()
@@ -550,11 +532,6 @@ fn grid_cell(
550 .bg(t.raise())532 .bg(t.raise())
551 .children(surface),533 .children(surface),
552 )534 )
553- .child(tile_name(
554- name,
555- if speaking { Ink::Paper } else { Ink::Dim },
556- t,
557- ))
558 .into_any_element()535 .into_any_element()
559 }536 }
560 537
@@ -577,10 +554,34 @@ pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, K
577 .children(muted.then(|| super::parts::small_icon(IconName::MicOff).text_color(t.bad())))554 .children(muted.then(|| super::parts::small_icon(IconName::MicOff).text_color(t.bad())))
578 }555 }
579 556
580-fn tile_name(name: impl Into<gpui_kit::SharedString>, ink: Ink, t: super::style::Tokens) -> Div {557+fn tile_name(
581- div()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)
582 .h(px(size::ICON))574 .h(px(size::ICON))
583- .flex()575+ .child(
584- .items_center()576+ super::parts::small_icon(match kind {
585- .child(words(name, Text::Label, ink, t))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+ )
586 }587 }
crates/client/src/gui/chat.rsmodified+1 -1
@@ -3005,7 +3005,7 @@ fn members_column(
3005 user.id,3005 user.id,
3006 kind,3006 kind,
3007 yumush.is_watching(user.id, kind),3007 yumush.is_watching(user.id, kind),
3008- (kind == Kind::Screen)3008+ (kind == Kind::Screen && chat.waves.share_audible(user.id))
3009 .then(|| chat.waves.share(user.id))3009 .then(|| chat.waves.share(user.id))
3010 .flatten(),3010 .flatten(),
3011 palette,3011 palette,
crates/client/src/gui/sidebar.rsmodified+1 -1
@@ -398,7 +398,7 @@ impl Yumush {
398 .justify_center()398 .justify_center()
399 .rounded_full()399 .rounded_full()
400 .text_color(palette.muted)400 .text_color(palette.muted)
401- .child(super::parts::small_icon(IconName::UserRoundCheck))401+ .child(super::parts::small_icon(IconName::Users))
402 .children(alert.then(|| {402 .children(alert.then(|| {
403 div()403 div()
404 .absolute()404 .absolute()
crates/client/src/gui/wave.rsmodified+7 -1
@@ -139,7 +139,13 @@ impl Waves {
139 }139 }
140 140
141 pub fn audible(&self, id: Id) -> bool {141 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))
143 }149 }
144 150
145 pub fn share(&self, id: Id) -> Option<&VecDeque<f32>> {151 pub fn share(&self, id: Id) -> Option<&VecDeque<f32>> {