forge
Explore
Log in

Don't you dare go Hollow

Stats names fit (watching header line, cpu/gpu model above their rows)

Browse files at this commit

0f8f4da3d8d09e5c3fedb6f0952da43f98300099Ahmet Kaan GümüşParent: 6b71a48
  • fix
    • stats names fit (watching header line, cpu/gpu model above their rows)
    • share audio lights the screen icon instead of squeezing the name
Show full message
🐛 fix: stats names fit (watching header line, cpu/gpu model above their rows); share audio lights the screen icon instead of squeezing the name
crates/client/src/gui/sidebar.rsmodified+2 -3
@@ -30,7 +30,6 @@ use super::{
30 profile::profile_popover,30 profile::profile_popover,
31 social::Relation,31 social::Relation,
32 style::{radius, size, space, text},32 style::{radius, size, space, text},
33- wave::mini_wave,
34 widget::{bare_input, compact_frame, icon_button},33 widget::{bare_input, compact_frame, icon_button},
35 };34 };
36 35
@@ -1009,6 +1008,7 @@ fn watch_pill(
1009 Kind::Camera => IconName::Video,1008 Kind::Camera => IconName::Video,
1010 Kind::Screen => IconName::ScreenShare,1009 Kind::Screen => IconName::ScreenShare,
1011 };1010 };
1011+ let sounding = wave.is_some();
1012 let tip = match (watching, kind) {1012 let tip = match (watching, kind) {
1013 (true, _) => "Stop watching",1013 (true, _) => "Stop watching",
1014 (false, Kind::Camera) => "Watch camera",1014 (false, Kind::Camera) => "Watch camera",
@@ -1031,13 +1031,12 @@ fn watch_pill(
1031 .child(1031 .child(
1032 Icon::new(icon)1032 Icon::new(icon)
1033 .size(px(size::ICON_SM))1033 .size(px(size::ICON_SM))
1034- .text_color(if watching {1034+ .text_color(if watching || sounding {
1035 palette.text1035 palette.text
1036 } else {1036 } else {
1037 palette.muted1037 palette.muted
1038 }),1038 }),
1039 )1039 )
1040- .children(wave.map(|history| mini_wave(history, 10., palette.text)))
1041 }1040 }
1042 1041
1043 pub(super) fn unread_badge(1042 pub(super) fn unread_badge(
crates/client/src/gui/voice_stats.rsmodified+22 -19
@@ -233,13 +233,11 @@ fn machine(usage: &Usage, t: Tokens) -> Div {
233 let memory = usage.memory;233 let memory = usage.memory;
234 let total_mb = memory.total_mb.max(1) as f32;234 let total_mb = memory.total_mb.max(1) as f32;
235 let over = |own: f32, total: f32| track(Fill::Over { own, total }, false, t).into_any_element();235 let over = |own: f32, total: f32| track(Fill::Over { own, total }, false, t).into_any_element();
236- let model = match usage.gpu.as_ref() {236+ let model = |name: &str| words(name.to_string(), Text::Caption, Ink::Faint, t).truncate();
237- Some(gpu) => format!("{} · {}", usage.cpu_model, gpu.model),
238- None => usage.cpu_model.to_string(),
239- };
240 237
241 stack(space::XS)238 stack(space::XS)
242- .child(title("This machine", model, None, t))239+ .child(title("This machine", String::new(), None, t))
240+ .child(model(&usage.cpu_model))
243 .child(line_row(241 .child(line_row(
244 label("CPU", t),242 label("CPU", t),
245 over(usage.total / 100., usage.machine / 100.),243 over(usage.total / 100., usage.machine / 100.),
@@ -274,6 +272,7 @@ fn machine(usage: &Usage, t: Tokens) -> Div {
274 let machine = gpu.machine;272 let machine = gpu.machine;
275 let vram_total = machine.vram_total_mb.max(machine.vram_used_mb).max(1) as f32;273 let vram_total = machine.vram_total_mb.max(machine.vram_used_mb).max(1) as f32;
276 stack(space::XS)274 stack(space::XS)
275+ .child(model(&gpu.model))
277 .child(line_row(276 .child(line_row(
278 label("GPU 3d", t),277 label("GPU 3d", t),
279 over(gpu.gfx / 100., machine.gfx / 100.),278 over(gpu.gfx / 100., machine.gfx / 100.),
@@ -386,20 +385,24 @@ fn watching(watching: &[(Id, Kind, WatchStats)], chat: &Chat, t: Tokens) -> Opti
386 .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps))385 .map_or("…".to_string(), |layer| resolution_text(layer, stats.fps))
387 );386 );
388 let bad = Quality::of_loss(stats.loss * 100.) == Quality::Poor;387 let bad = Quality::of_loss(stats.loss * 100.) == Quality::Poor;
389- line_row(388+ stack(space::XXS)
390- band(space::XS)389+ .child(
391- .child(390+ band(space::SM)
392- words(name, Text::Label, Ink::Paper, t)391+ .child(
393- .text_color(t.person(*user_id))392+ words(name, Text::Label, Ink::Paper, t)
394- .flex_none(),393+ .text_color(t.person(*user_id))
395- )394+ .min_w_0()
396- .child(words(detail, Text::Caption, Ink::Faint, t))395+ .truncate(),
397- .into_any_element(),396+ )
398- track(Fill::Part(stats.kbps as f32 / max), bad, t).into_any_element(),397+ .child(words(detail, Text::Caption, Ink::Faint, t).flex_none()),
399- rate(stats.kbps),398+ )
400- bad,399+ .child(line_row(
401- t,400+ label("rate", t),
402- )401+ track(Fill::Part(stats.kbps as f32 / max), bad, t).into_any_element(),
402+ rate(stats.kbps),
403+ bad,
404+ t,
405+ ))
403 }))406 }))
404 .child(407 .child(
405 band(space::MD)408 band(space::MD)
crates/client/src/gui/wave.rsmodified+2 -42
@@ -1,11 +1,9 @@
1 use std::collections::{HashMap, HashSet, VecDeque};1 use std::collections::{HashMap, HashSet, VecDeque};
2 2
3 use common::model::Id;3 use common::model::Id;
4-use gpui_kit::{4+use gpui_kit::{Hsla, IntoElement, PathBuilder, Styled, canvas, point, px};
5- Div, Hsla, IntoElement, ParentElement, PathBuilder, Styled, canvas, div, point, px,
6-};
7 5
8-use super::style::{radius, stroke};6+use super::style::stroke;
9 7
10 use crate::net::Levels;8 use crate::net::Levels;
11 9
@@ -14,10 +12,6 @@ const GRAVITY: f32 = 0.012;
14 const HOLD_TICKS: u8 = 3;12 const HOLD_TICKS: u8 = 3;
15 const GONE: f32 = 0.02;13 const GONE: f32 = 0.02;
16 const AUDIBLE: f32 = 0.1;14 const AUDIBLE: f32 = 0.1;
17-const BAR_WIDTH: f32 = 2.;
18-const MIN_BAR: f32 = 1.5;
19-const MINI_BARS: usize = 11;
20-const GAP: f32 = 1.;
21 15
22 pub struct Wave {16 pub struct Wave {
23 bars: VecDeque<f32>,17 bars: VecDeque<f32>,
@@ -142,40 +136,6 @@ impl Waves {
142 }136 }
143 }137 }
144 138
145-pub fn mini_wave(history: &VecDeque<f32>, size: f32, color: Hsla) -> Div {
146- let group = history.len().div_ceil(MINI_BARS).max(1);
147- let bars: Vec<f32> = history
148- .iter()
149- .copied()
150- .collect::<Vec<_>>()
151- .chunks(group)
152- .map(|chunk| chunk.iter().copied().fold(0.0, f32::max))
153- .collect();
154- slot(MINI_BARS, Some(bars), size, color)
155-}
156-
157-fn slot(count: usize, bars: Option<Vec<f32>>, size: f32, color: Hsla) -> Div {
158- div()
159- .flex_shrink_0()
160- .w(px(count as f32 * (BAR_WIDTH + GAP) - GAP))
161- .children(bars.map(|bars| wave(&bars, size, color)))
162-}
163-
164-fn wave(bars: &[f32], size: f32, color: Hsla) -> Div {
165- div()
166- .flex()
167- .items_center()
168- .gap(px(GAP))
169- .h(px(size))
170- .children(bars.iter().map(|bar| {
171- div()
172- .w(px(BAR_WIDTH))
173- .h(px((size * bar).max(MIN_BAR)))
174- .rounded(px(radius::SM))
175- .bg(color)
176- }))
177-}
178-
179 pub fn line_of(levels: Vec<f32>, slots: usize, color: Hsla) -> impl IntoElement {139 pub fn line_of(levels: Vec<f32>, slots: usize, color: Hsla) -> impl IntoElement {
180 canvas(140 canvas(
181 |_, _, _| {},141 |_, _, _| {},