diff --git a/crates/client/src/gui/builder/overview.rs b/crates/client/src/gui/builder/overview.rs index b36dcf4..2a2b177 100644 --- a/crates/client/src/gui/builder/overview.rs +++ b/crates/client/src/gui/builder/overview.rs @@ -218,6 +218,7 @@ impl Yumush { .child(div().p(px(space::LG)).child(voice_stats::stats_panel( stats, &|id| self.chat.name_of(id), + voice_stats::Detail::Full, palette, ))), ); diff --git a/crates/client/src/gui/builder/users.rs b/crates/client/src/gui/builder/users.rs index 0e6109e..be23517 100644 --- a/crates/client/src/gui/builder/users.rs +++ b/crates/client/src/gui/builder/users.rs @@ -1058,6 +1058,7 @@ impl Yumush { super::super::voice_stats::stats_panel( stats, &|id| self.chat.name_of(id), + super::super::voice_stats::Detail::Full, palette, ) .pt(px(space::MD)) diff --git a/crates/client/src/gui/call_bar.rs b/crates/client/src/gui/call_bar.rs index 7e22dae..49d452a 100644 --- a/crates/client/src/gui/call_bar.rs +++ b/crates/client/src/gui/call_bar.rs @@ -180,9 +180,16 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div { ) .child( div() + .id("bar_ping_line") .flex_none() .w(px(size::ROW)) .h(px(size::ICON)) + .cursor_pointer() + .tip("Connection stats") + .on_click({ + let stats = run(&actions.stats); + move |_, window, cx| stats(window, cx) + }) .child(super::parts::spark( pings, super::voice_stats::SAMPLE_HISTORY, diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 3f1eab5..64c008a 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -1450,6 +1450,10 @@ impl Yumush { .child(voice_stats::stats_panel( &self.chat.stats, &|id| self.chat.name_of(id), + match at { + StatsAt::Header => voice_stats::Detail::Full, + StatsAt::Dock => voice_stats::Detail::Connection, + }, palette, )), ) diff --git a/crates/client/src/gui/voice_stats.rs b/crates/client/src/gui/voice_stats.rs index 4590dd3..98a9571 100644 --- a/crates/client/src/gui/voice_stats.rs +++ b/crates/client/src/gui/voice_stats.rs @@ -79,9 +79,30 @@ pub fn quality(samples: &VecDeque) -> Option { samples.back().map(Quality::of) } -pub fn stats_panel(stats: &Stats, name: &dyn Fn(Id) -> String, palette: Palette) -> Div { +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum Detail { + Connection, + Full, +} + +pub fn stats_panel( + stats: &Stats, + name: &dyn Fn(Id) -> String, + detail: Detail, + palette: Palette, +) -> Div { let t = palette.tokens; let share = &stats.share; + if detail == Detail::Connection { + return stack(space::XL) + .w(px(COLUMN_W)) + .when(!stats.voice.is_empty(), |column| { + column.child(connection(stats, t)) + }) + .when(!stats.traffic.is_empty(), |column| { + column.child(traffic(stats, t)) + }); + } band(space::XXL) .items_start() .flex_wrap()