forge
Explore
Log in

Don't you dare go Hollow

Ping line opens connection stats too

Browse files at this commit

1b3b5a4256edbc55ec6f15ff36fcf6e055d6223dAhmet Kaan GümüşParent: 89a7c6e
  • feat
    • ping line opens connection stats too
    • the call bar sheet shows only connection and traffic, full detail stays in the header stats
Show full message
✨ feat: ping line opens connection stats too; the call bar sheet shows only connection and traffic, full detail stays in the header stats
crates/client/src/gui/builder/overview.rsmodified+1 -0
@@ -218,6 +218,7 @@ impl Yumush {
218218 .child(div().p(px(space::LG)).child(voice_stats::stats_panel(
219219 stats,
220220 &|id| self.chat.name_of(id),
221+ voice_stats::Detail::Full,
221222 palette,
222223 ))),
223224 );
crates/client/src/gui/builder/users.rsmodified+1 -0
@@ -1058,6 +1058,7 @@ impl Yumush {
10581058 super::super::voice_stats::stats_panel(
10591059 stats,
10601060 &|id| self.chat.name_of(id),
1061+ super::super::voice_stats::Detail::Full,
10611062 palette,
10621063 )
10631064 .pt(px(space::MD))
crates/client/src/gui/call_bar.rsmodified+7 -0
@@ -180,9 +180,16 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
180180 )
181181 .child(
182182 div()
183+ .id("bar_ping_line")
183184 .flex_none()
184185 .w(px(size::ROW))
185186 .h(px(size::ICON))
187+ .cursor_pointer()
188+ .tip("Connection stats")
189+ .on_click({
190+ let stats = run(&actions.stats);
191+ move |_, window, cx| stats(window, cx)
192+ })
186193 .child(super::parts::spark(
187194 pings,
188195 super::voice_stats::SAMPLE_HISTORY,
crates/client/src/gui/chat.rsmodified+4 -0
@@ -1450,6 +1450,10 @@ impl Yumush {
14501450 .child(voice_stats::stats_panel(
14511451 &self.chat.stats,
14521452 &|id| self.chat.name_of(id),
1453+ match at {
1454+ StatsAt::Header => voice_stats::Detail::Full,
1455+ StatsAt::Dock => voice_stats::Detail::Connection,
1456+ },
14531457 palette,
14541458 )),
14551459 )
crates/client/src/gui/voice_stats.rsmodified+22 -1
@@ -79,9 +79,30 @@ pub fn quality(samples: &VecDeque<VoiceSample>) -> Option<Quality> {
7979 samples.back().map(Quality::of)
8080 }
8181
82-pub fn stats_panel(stats: &Stats, name: &dyn Fn(Id) -> String, palette: Palette) -> Div {
82+#[derive(Clone, Copy, PartialEq, Eq)]
83+pub enum Detail {
84+ Connection,
85+ Full,
86+}
87+
88+pub fn stats_panel(
89+ stats: &Stats,
90+ name: &dyn Fn(Id) -> String,
91+ detail: Detail,
92+ palette: Palette,
93+) -> Div {
8394 let t = palette.tokens;
8495 let share = &stats.share;
96+ if detail == Detail::Connection {
97+ return stack(space::XL)
98+ .w(px(COLUMN_W))
99+ .when(!stats.voice.is_empty(), |column| {
100+ column.child(connection(stats, t))
101+ })
102+ .when(!stats.traffic.is_empty(), |column| {
103+ column.child(traffic(stats, t))
104+ });
105+ }
85106 band(space::XXL)
86107 .items_start()
87108 .flex_wrap()