diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index 1e1041f..f35f356 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -30,7 +30,6 @@ use super::{ profile::profile_popover, social::Relation, style::{radius, size, space, text}, - wave::mini_wave, widget::{bare_input, compact_frame, icon_button}, }; @@ -1009,6 +1008,7 @@ fn watch_pill( Kind::Camera => IconName::Video, Kind::Screen => IconName::ScreenShare, }; + let sounding = wave.is_some(); let tip = match (watching, kind) { (true, _) => "Stop watching", (false, Kind::Camera) => "Watch camera", @@ -1031,13 +1031,12 @@ fn watch_pill( .child( Icon::new(icon) .size(px(size::ICON_SM)) - .text_color(if watching { + .text_color(if watching || sounding { palette.text } else { palette.muted }), ) - .children(wave.map(|history| mini_wave(history, 10., palette.text))) } pub(super) fn unread_badge( diff --git a/crates/client/src/gui/voice_stats.rs b/crates/client/src/gui/voice_stats.rs index 438ac5c..0c4e3a0 100644 --- a/crates/client/src/gui/voice_stats.rs +++ b/crates/client/src/gui/voice_stats.rs @@ -233,13 +233,11 @@ fn machine(usage: &Usage, t: Tokens) -> Div { let memory = usage.memory; let total_mb = memory.total_mb.max(1) as f32; let over = |own: f32, total: f32| track(Fill::Over { own, total }, false, t).into_any_element(); - let model = match usage.gpu.as_ref() { - Some(gpu) => format!("{} · {}", usage.cpu_model, gpu.model), - None => usage.cpu_model.to_string(), - }; + let model = |name: &str| words(name.to_string(), Text::Caption, Ink::Faint, t).truncate(); stack(space::XS) - .child(title("This machine", model, None, t)) + .child(title("This machine", String::new(), None, t)) + .child(model(&usage.cpu_model)) .child(line_row( label("CPU", t), over(usage.total / 100., usage.machine / 100.), @@ -274,6 +272,7 @@ fn machine(usage: &Usage, t: Tokens) -> Div { let machine = gpu.machine; let vram_total = machine.vram_total_mb.max(machine.vram_used_mb).max(1) as f32; stack(space::XS) + .child(model(&gpu.model)) .child(line_row( label("GPU 3d", t), over(gpu.gfx / 100., machine.gfx / 100.), @@ -386,20 +385,24 @@ fn watching(watching: &[(Id, Kind, WatchStats)], chat: &Chat, t: Tokens) -> Opti .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps)) ); let bad = Quality::of_loss(stats.loss * 100.) == Quality::Poor; - line_row( - band(space::XS) - .child( - words(name, Text::Label, Ink::Paper, t) - .text_color(t.person(*user_id)) - .flex_none(), - ) - .child(words(detail, Text::Caption, Ink::Faint, t)) - .into_any_element(), - track(Fill::Part(stats.kbps as f32 / max), bad, t).into_any_element(), - rate(stats.kbps), - bad, - t, - ) + stack(space::XXS) + .child( + band(space::SM) + .child( + words(name, Text::Label, Ink::Paper, t) + .text_color(t.person(*user_id)) + .min_w_0() + .truncate(), + ) + .child(words(detail, Text::Caption, Ink::Faint, t).flex_none()), + ) + .child(line_row( + label("rate", t), + track(Fill::Part(stats.kbps as f32 / max), bad, t).into_any_element(), + rate(stats.kbps), + bad, + t, + )) })) .child( band(space::MD) diff --git a/crates/client/src/gui/wave.rs b/crates/client/src/gui/wave.rs index 070aadb..cc31282 100644 --- a/crates/client/src/gui/wave.rs +++ b/crates/client/src/gui/wave.rs @@ -1,11 +1,9 @@ use std::collections::{HashMap, HashSet, VecDeque}; use common::model::Id; -use gpui_kit::{ - Div, Hsla, IntoElement, ParentElement, PathBuilder, Styled, canvas, div, point, px, -}; +use gpui_kit::{Hsla, IntoElement, PathBuilder, Styled, canvas, point, px}; -use super::style::{radius, stroke}; +use super::style::stroke; use crate::net::Levels; @@ -14,10 +12,6 @@ const GRAVITY: f32 = 0.012; const HOLD_TICKS: u8 = 3; const GONE: f32 = 0.02; const AUDIBLE: f32 = 0.1; -const BAR_WIDTH: f32 = 2.; -const MIN_BAR: f32 = 1.5; -const MINI_BARS: usize = 11; -const GAP: f32 = 1.; pub struct Wave { bars: VecDeque, @@ -142,40 +136,6 @@ impl Waves { } } -pub fn mini_wave(history: &VecDeque, size: f32, color: Hsla) -> Div { - let group = history.len().div_ceil(MINI_BARS).max(1); - let bars: Vec = history - .iter() - .copied() - .collect::>() - .chunks(group) - .map(|chunk| chunk.iter().copied().fold(0.0, f32::max)) - .collect(); - slot(MINI_BARS, Some(bars), size, color) -} - -fn slot(count: usize, bars: Option>, size: f32, color: Hsla) -> Div { - div() - .flex_shrink_0() - .w(px(count as f32 * (BAR_WIDTH + GAP) - GAP)) - .children(bars.map(|bars| wave(&bars, size, color))) -} - -fn wave(bars: &[f32], size: f32, color: Hsla) -> Div { - div() - .flex() - .items_center() - .gap(px(GAP)) - .h(px(size)) - .children(bars.iter().map(|bar| { - div() - .w(px(BAR_WIDTH)) - .h(px((size * bar).max(MIN_BAR))) - .rounded(px(radius::SM)) - .bg(color) - })) -} - pub fn line_of(levels: Vec, slots: usize, color: Hsla) -> impl IntoElement { canvas( |_, _, _| {},