forge
Explore
Log in

Don't you dare go Hollow

Stream card in the stats language (name in hue, layer line, rate/loss/latency, loss spark)

Browse files at this commit

6d42b4458ee87d8d3c04b47f8f3d98ba129ed342Ahmet Kaan GümüşParent: 62f41ca
  • feat
    • stream card in the stats language (name in hue, layer line, rate/loss/latency, loss spark)
    • tile captions are name + voice line on a scrim
    • bare stats toggle and paper volume in the viewer
Show full message
✨ feat: stream card in the stats language (name in hue, layer line, rate/loss/latency, loss spark); tile captions are name + voice line on a scrim; bare stats toggle and paper volume in the viewer
crates/client/src/gui/camera_view.rsmodified+21 -42
@@ -4,7 +4,7 @@ use common::model::Id;
4 4
5 use common::share::{Fps, Kind, Quality, Resolution};5 use common::share::{Fps, Kind, Quality, Resolution};
6 use gpui_kit::{6 use gpui_kit::{
7- AnyElement, AppContext as _, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement,7+ AnyElement, AppContext as _, Context, Div, Entity, InteractiveElement, IntoElement,
8 ParentElement, StatefulInteractiveElement, Styled, Task, Window, assets::IconName,8 ParentElement, StatefulInteractiveElement, Styled, Task, Window, assets::IconName,
9 component::Icon, div, px, transparent_black,9 component::Icon, div, px, transparent_black,
10 };10 };
@@ -13,12 +13,10 @@ use super::{
13 Palette, Tooltip as _, Yumush, avatar, clickable,13 Palette, Tooltip as _, Yumush, avatar, clickable,
14 media_view::into_render_image,14 media_view::into_render_image,
15 notify_error,15 notify_error,
16- parts::{Voice, caption, voice_line},16+ parts::{Ink, Text, Voice, caption, scrim, voice_line, words},
17- share_view,
18 style::{radius, size, space, text},17 style::{radius, size, space, text},
19 surface::Surface,18 surface::Surface,
20 text,19 text,
21- wave::mini_wave,
22 widget::spawn_warn,20 widget::spawn_warn,
23 };21 };
24 use crate::share::session::WatchQuality;22 use crate::share::session::WatchQuality;
@@ -531,54 +529,35 @@ fn grid_cell(
531 }529 }
532 }530 }
533 531
534-pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, kind): (Id, Kind)) -> Div {532+pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, Kind)) -> Div {
535- let tone = match kind {533+ let t = palette.tokens;
536- Kind::Screen => palette.screen,
537- Kind::Camera => palette.camera,
538- };
539 let name = yumush534 let name = yumush
540 .chat535 .chat
541 .author(user_id)536 .author(user_id)
542- .map_or("Someone", |user| user.username.as_str());537+ .map_or_else(|| user_id.to_string(), |user| user.username.clone());
543- let wave = yumush538+ let speaking = yumush.chat.waves.speaking.contains(&user_id);
544- .chat
545- .waves
546- .speaking
547- .contains(&user_id)
548- .then(|| yumush.chat.waves.voice(user_id))
549- .flatten();
550- let shared = yumush
551- .chat
552- .voice_community()
553- .and_then(|community_id| yumush.chat.share_of(community_id, user_id, kind))
554- .is_some();
555 let muted = yumush.chat.server_muted.contains(&user_id)539 let muted = yumush.chat.server_muted.contains(&user_id)
556 || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted));540 || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted));
557 541
558- div()542+ scrim(t)
559- .h(px(size::CONTROL_SM))543+ .child(words(name, Text::Label, Ink::Paper, t).flex_none())
560- .px(px(space::SM))
561- .rounded(px(radius::LG))
562- .bg(gpui_kit::black())
563- .flex()
564- .items_center()
565- .gap(px(space::SM))
566- .text_size(text(text::CAPTION))
567- .children(shared.then(|| {
568- Icon::new(share_view::kind_icon(kind))
569- .size(px(size::ICON_SM))
570- .text_color(tone)
571- }))
572 .child(544 .child(
573 div()545 div()
574- .font_weight(FontWeight::MEDIUM)546+ .w(px(size::CONTROL))
575- .text_color(gpui_kit::white())547+ .h(px(space::MD))
576- .child(name.to_string()),548+ .child(voice_line(
549+ yumush.chat.waves.voice(user_id),
550+ if speaking {
551+ Voice::Live(t.person(user_id))
552+ } else {
553+ Voice::Quiet
554+ },
555+ t,
556+ )),
577 )557 )
578- .children(wave.map(|history| mini_wave(history, 10., palette.ok)))558+ .children(muted.then(|| {
579- .children((muted && wave.is_none()).then(|| {
580 Icon::new(IconName::MicOff)559 Icon::new(IconName::MicOff)
581 .size(px(size::ICON_SM))560 .size(px(size::ICON_SM))
582- .text_color(palette.danger)561+ .text_color(t.bad())
583 }))562 }))
584 }563 }
crates/client/src/gui/parts.rsmodified+8 -0
@@ -320,6 +320,14 @@ pub fn popover(t: Tokens) -> Div {
320 .py(px(space::LG + 2.))320 .py(px(space::LG + 2.))
321 }321 }
322 322
323+pub fn scrim(t: Tokens) -> Div {
324+ band(space::SM)
325+ .h(px(size::CONTROL_SM))
326+ .px(px(space::MD))
327+ .rounded(px(radius::FULL))
328+ .bg(t.ground().opacity(0.8))
329+}
330+
323 pub fn caption(name: impl Into<SharedString>, line: impl IntoElement, t: Tokens) -> Div {331 pub fn caption(name: impl Into<SharedString>, line: impl IntoElement, t: Tokens) -> Div {
324 band(space::MD)332 band(space::MD)
325 .h(px(16.))333 .h(px(16.))
crates/client/src/gui/share_view.rsmodified+24 -67
@@ -35,6 +35,7 @@ use super::{
35 clickable, entity_action,35 clickable, entity_action,
36 media_view::into_render_image,36 media_view::into_render_image,
37 notify_error,37 notify_error,
38+ parts::{self, Tone, scrim},
38 settings_page::segmented,39 settings_page::segmented,
39 stream_stats::{stream_card, watch_stats},40 stream_stats::{stream_card, watch_stats},
40 style::{radius, size, space, text},41 style::{radius, size, space, text},
@@ -561,10 +562,7 @@ impl Yumush {
561 (IconName::Maximize, "Fullscreen")562 (IconName::Maximize, "Fullscreen")
562 };563 };
563 let audio = viewer.kind == Kind::Screen;564 let audio = viewer.kind == Kind::Screen;
564- let tone = match viewer.kind {565+ let t = palette.tokens;
565- Kind::Screen => palette.screen,
566- Kind::Camera => palette.camera,
567- };
568 let (user_id, kind) = (viewer.user_id, viewer.kind);566 let (user_id, kind) = (viewer.user_id, viewer.kind);
569 let stats = watch_stats(self, user_id, kind);567 let stats = watch_stats(self, user_id, kind);
570 let bar = viewer.active.elapsed() < BAR_TTL;568 let bar = viewer.active.elapsed() < BAR_TTL;
@@ -610,52 +608,26 @@ impl Yumush {
610 )608 )
611 .children(stats.map(|_| {609 .children(stats.map(|_| {
612 let entity = entity.clone();610 let entity = entity.clone();
613- let top = self.share_top(viewer.user_id, viewer.kind);611+ parts::icon_button(
614- div()612+ "viewer_stats_button",
615- .occlude()613+ IconName::ChartBar,
616- .absolute()614+ "Stream stats",
617- .right(px(space::MD))615+ if viewer.stats { Tone::On } else { Tone::Idle },
618- .top(px(space::MD))616+ t,
619- .when(!bar && !viewer.stats, |this| this.invisible())617+ move |_, cx| {
620- .flex()618+ entity.update(cx, |yumush, cx| {
621- .items_center()619+ if let Some(viewer) = yumush.chat.viewer.as_mut() {
622- .gap(px(space::SM))620+ viewer.stats = !viewer.stats;
623- .child(621+ }
624- div()622+ cx.notify();
625- .h(px(size::CHIP))623+ })
626- .px(px(space::SM))624+ },
627- .flex()625+ )
628- .items_center()626+ .occlude()
629- .rounded(px(radius::MD))627+ .absolute()
630- .bg(palette.field)628+ .right(px(space::MD))
631- .text_size(text(text::CAPTION))629+ .top(px(space::MD))
632- .text_color(tone)630+ .when(!bar && !viewer.stats, |this| this.invisible())
633- .child(format!("{}p{}", top.resolution.height(), top.fps.value())),
634- )
635- .child(
636- div()
637- .id("viewer_stats_button")
638- .tip("Stream stats")
639- .size(px(size::CONTROL_SM))
640- .flex()
641- .flex_shrink_0()
642- .items_center()
643- .justify_center()
644- .rounded(px(radius::MD))
645- .cursor_pointer()
646- .bg(palette.field)
647- .text_color(if viewer.stats { tone } else { palette.muted })
648- .hover(|style| style.bg(palette.hover).text_color(palette.text))
649- .on_click(move |_, _, cx| {
650- entity.update(cx, |yumush, cx| {
651- if let Some(viewer) = yumush.chat.viewer.as_mut() {
652- viewer.stats = !viewer.stats;
653- }
654- cx.notify();
655- })
656- })
657- .child(Icon::new(IconName::ChartBar).size(px(size::ICON_SM))),
658- )
659 }))631 }))
660 .when(viewer.stats, |this| {632 .when(viewer.stats, |this| {
661 this.child(633 this.child(
@@ -678,14 +650,10 @@ impl Yumush {
678 .on_mouse_up(MouseButton::Left, |_, _, cx| cx.stop_propagation())650 .on_mouse_up(MouseButton::Left, |_, _, cx| cx.stop_propagation())
679 .when(!bar, |this| this.invisible())651 .when(!bar, |this| this.invisible())
680 .child(652 .child(
681- div()653+ scrim(t)
682 .h(px(size::CONTROL))654 .h(px(size::CONTROL))
683 .px(px(space::XS))655 .px(px(space::XS))
684- .flex()
685- .items_center()
686 .gap(px(space::XS))656 .gap(px(space::XS))
687- .rounded(px(radius::LG))
688- .bg(palette.field)
689 .children(audio.then(|| {657 .children(audio.then(|| {
690 let muted = self.settings.share.volume == 0.;658 let muted = self.settings.share.volume == 0.;
691 icon_button(659 icon_button(
@@ -703,11 +671,7 @@ impl Yumush {
703 )671 )
704 }))672 }))
705 .children(audio.then(|| {673 .children(audio.then(|| {
706- div().w(px(VOLUME_WIDTH)).child(674+ div().w(px(VOLUME_WIDTH)).child(Slider::new(&viewer.volume))
707- Slider::new(&viewer.volume)
708- .bg(palette.screen)
709- .text_color(palette.text),
710- )
711 }))675 }))
712 .child(icon_button(676 .child(icon_button(
713 format!("share_fullscreen_{}", viewer.fullscreen),677 format!("share_fullscreen_{}", viewer.fullscreen),
@@ -728,13 +692,6 @@ impl Yumush {
728 }692 }
729 }693 }
730 694
731-pub(super) fn kind_icon(kind: Kind) -> IconName {
732- match kind {
733- Kind::Screen => IconName::ScreenShare,
734- Kind::Camera => IconName::Video,
735- }
736-}
737-
738 fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Div {695 fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Div {
739 let settings = &yumush.settings.share;696 let settings = &yumush.settings.share;
740 let kind = yumush.share_tab;697 let kind = yumush.share_tab;
crates/client/src/gui/stream_stats.rsmodified+76 -159
@@ -1,13 +1,13 @@
1 use common::{model::Id, share::Kind};1 use common::{model::Id, share::Kind};
2-use gpui_kit::{Div, FontWeight, Hsla, ParentElement, Styled, component::Icon, div, px};2+use gpui_kit::{Div, FontWeight, ParentElement, Styled, div, px};
3 3
4 use super::{4 use super::{
5 Palette, Yumush,5 Palette, Yumush,
6- share_view::kind_icon,6+ parts::{Ink, Text, band, popover, spark, words},
7- style::{radius, size, space, text},7+ style::{size, space},
8- voice_stats::rate,8+ voice_stats::{GOOD_LOSS, SAMPLE_HISTORY, engine_label, kind_word, number, resolution_text},
9 };9 };
10-use crate::{media::decode::Engine, share::session::WatchStats};10+use crate::share::session::WatchStats;
11 11
12 pub(super) fn watch_stats(yumush: &Yumush, user_id: Id, kind: Kind) -> Option<&WatchStats> {12 pub(super) fn watch_stats(yumush: &Yumush, user_id: Id, kind: Kind) -> Option<&WatchStats> {
13 yumush13 yumush
@@ -20,14 +20,11 @@ pub(super) fn watch_stats(yumush: &Yumush, user_id: Id, kind: Kind) -> Option<&W
20 }20 }
21 21
22 pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Palette) -> Div {22 pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Palette) -> Div {
23- let (tone, noun) = match kind {23+ let t = palette.tokens;
24- Kind::Screen => (palette.screen, "screen"),24+ let name = yumush
25- Kind::Camera => (palette.camera, "camera"),
26- };
27- let user = yumush
28 .chat25 .chat
29 .author(user_id)26 .author(user_id)
30- .map_or("Someone", |user| user.username.as_str());27+ .map_or_else(|| user_id.to_string(), |user| user.username.clone());
31 let stats = watch_stats(yumush, user_id, kind);28 let stats = watch_stats(yumush, user_id, kind);
32 let losses: Vec<f32> = yumush29 let losses: Vec<f32> = yumush
33 .chat30 .chat
@@ -37,163 +34,83 @@ pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Pal
37 .flatten()34 .flatten()
38 .copied()35 .copied()
39 .collect();36 .collect();
40- let value = |format: fn(&WatchStats) -> String| stats.map_or("…".to_string(), format);37+ let top = losses
38+ .iter()
39+ .fold(GOOD_LOSS / 100., |top, loss| top.max(*loss));
40+ let loss = stats.map(|stats| stats.loss * 100.);
41+ let bad = loss.is_some_and(|loss| loss > GOOD_LOSS);
42+ let field = |value: Option<String>| value.unwrap_or_else(|| "…".into());
43+ let detail = stats.map_or("…".to_string(), |stats| {
44+ let layer = stats.layer.map_or("…".to_string(), |layer| {
45+ format!(
46+ "{} · {}",
47+ resolution_text(layer, stats.fps),
48+ layer.codec.name()
49+ )
50+ });
51+ match stats.engine {
52+ Some(engine) => format!("{layer} · {}", engine_label(engine)),
53+ None => layer,
54+ }
55+ });
41 56
42- div()57+ popover(t)
43 .w(px(size::POPOVER))58 .w(px(size::POPOVER))
44- .p(px(space::MD))
45- .flex()
46- .flex_col()
47 .gap(px(space::MD))59 .gap(px(space::MD))
48- .text_size(super::text(text::CAPTION))
49- .rounded(px(radius::LG))
50- .bg(palette.field)
51 .child(60 .child(
52- div()61+ band(space::SM)
53- .flex()
54- .items_center()
55- .gap(px(space::SM))
56 .child(62 .child(
57- Icon::new(kind_icon(kind))63+ words(name, Text::Label, Ink::Paper, t)
58- .size(px(size::ICON_SM))64+ .text_color(t.person(user_id))
59- .flex_none()65+ .font_weight(FontWeight::MEDIUM)
60- .text_color(tone),66+ .flex_none(),
61 )67 )
62- .child(68+ .child(words(kind_word(kind), Text::Caption, Ink::Faint, t)),
63- div()
64- .font_weight(FontWeight::SEMIBOLD)
65- .child(format!("{user}'s {noun}")),
66- ),
67- )
68- .child(graph(&losses, tone, palette))
69- .child(section(
70- "Stream",
71- vec![
72- row(
73- "Resolution",
74- value(|stats| {
75- stats.layer.as_ref().map_or("…".to_string(), |layer| {
76- format!("{}p", layer.quality.resolution.height())
77- })
78- }),
79- palette,
80- ),
81- row("FPS", value(|stats| format!("{:.0}", stats.fps)), palette),
82- row(
83- "Codec",
84- value(|stats| {
85- stats
86- .layer
87- .map_or("…", |layer| layer.codec.name())
88- .to_string()
89- }),
90- palette,
91- ),
92- row(
93- "Engine",
94- value(|stats| {
95- match stats.engine {
96- Some(Engine::Hardware) => "HW",
97- Some(Engine::Software) => "SW",
98- None => "…",
99- }
100- .to_string()
101- }),
102- palette,
103- ),
104- row("Bitrate", value(|stats| rate(stats.kbps)), palette),
105- ],
106- palette,
107- ))
108- .child(section(
109- "Network",
110- vec![
111- row(
112- "Loss",
113- value(|stats| format!("{:.1} %", stats.loss * 100.)),
114- palette,
115- ),
116- row(
117- "Buffer",
118- value(|stats| format!("{} ms", stats.buffer_ms)),
119- palette,
120- ),
121- row(
122- "Latency",
123- value(|stats| {
124- stats
125- .latency_ms
126- .map_or("…".to_string(), |ms| format!("{ms} ms"))
127- }),
128- palette,
129- ),
130- row(
131- "Keyframes",
132- value(|stats| stats.keyframes.to_string()),
133- palette,
134- ),
135- row("NACKs", value(|stats| stats.nacks.to_string()), palette),
136- ],
137- palette,
138- ))
139-}
140-
141-fn graph(losses: &[f32], color: Hsla, palette: Palette) -> Div {
142- let top = losses.iter().fold(1_f32, |top, loss| top.max(loss * 100.));
143- let levels: Vec<f32> = losses.iter().map(|loss| loss * 100. / top).collect();
144-
145- div()
146- .flex()
147- .gap(px(space::SM))
148- .h(px(size::ROW))
149- .child(
150- div()
151- .w(px(size::CONTROL))
152- .h_full()
153- .flex()
154- .flex_col()
155- .justify_between()
156- .text_size(super::text(text::CAPTION))
157- .text_color(palette.muted)
158- .children([top, top / 2., 0.].map(|value| div().child(format!("{value:.1}%")))),
159- )
160- .child(
161- div()
162- .flex_1()
163- .h_full()
164- .rounded(px(radius::SM))
165- .bg(palette.window)
166- .child(super::wave::line(levels, color)),
167 )69 )
168-}70+ .child(words(detail, Text::Caption, Ink::Dim, t))
169-
170-fn section(title: &'static str, rows: Vec<Div>, palette: Palette) -> Div {
171- div()
172- .flex()
173- .flex_col()
174- .gap(px(space::XS))
175 .child(71 .child(
176- div()72+ band(space::LG)
177- .text_size(super::text(text::CAPTION))73+ .child(number(
178- .font_weight(FontWeight::SEMIBOLD)74+ field(stats.map(|stats| stats.kbps.to_string())),
179- .text_color(palette.muted)75+ "kb/s",
180- .child(title),76+ false,
77+ t,
78+ ))
79+ .child(number(
80+ field(loss.map(|loss| format!("{loss:.1}"))),
81+ "loss %",
82+ bad,
83+ t,
84+ ))
85+ .child(number(
86+ field(
87+ stats
88+ .and_then(|stats| stats.latency_ms)
89+ .map(|ms| ms.to_string()),
90+ ),
91+ "latency ms",
92+ false,
93+ t,
94+ )),
181 )95 )
182- .children(rows)96+ .child(div().h(px(size::CONTROL_SM)).child(spark(
183-}97+ losses.iter().map(|loss| loss / top).collect(),
184-98+ SAMPLE_HISTORY,
185-fn row(key: &'static str, value: String, palette: Palette) -> Div {99+ if bad { t.bad() } else { t.paper() },
186- div()100+ )))
187- .flex()
188- .items_center()
189- .justify_between()
190- .gap(px(space::SM))
191- .text_size(super::text(text::CAPTION))
192- .child(div().text_color(palette.muted).child(key))
193 .child(101 .child(
194- div()102+ band(space::MD).children(
195- .font_family(super::MONO_FONT)103+ stats
196- .text_color(palette.text)104+ .map(|stats| {
197- .child(value),105+ [
106+ format!("buffer {} ms", stats.buffer_ms),
107+ format!("keyframes {}", stats.keyframes),
108+ format!("NACKs {}", stats.nacks),
109+ ]
110+ .map(|text| words(text, Text::Caption, Ink::Faint, t))
111+ })
112+ .into_iter()
113+ .flatten(),
114+ ),
198 )115 )
199 }116 }
crates/client/src/gui/voice_stats.rsmodified+5 -5
@@ -22,7 +22,7 @@ const LABEL_W: f32 = size::ROW * 2.;
22 const VALUE_W: f32 = size::THUMB;22 const VALUE_W: f32 = size::THUMB;
23 const COLUMN_W: f32 = size::TALK + size::ROW * 2.;23 const COLUMN_W: f32 = size::TALK + size::ROW * 2.;
24 const PING_SCALE: f32 = 150.;24 const PING_SCALE: f32 = 150.;
25-const GOOD_LOSS: f32 = 2.;25+pub(super) const GOOD_LOSS: f32 = 2.;
26 const FAIR_LOSS: f32 = 8.;26 const FAIR_LOSS: f32 = 8.;
27 27
28 #[derive(Debug, Clone, Copy, PartialEq, Eq)]28 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -123,7 +123,7 @@ fn label(text: &'static str, t: Tokens) -> AnyElement {
123 words(text, Text::Caption, Ink::Dim, t).into_any_element()123 words(text, Text::Caption, Ink::Dim, t).into_any_element()
124 }124 }
125 125
126-fn number(value: String, name: &'static str, bad: bool, t: Tokens) -> Div {126+pub(super) fn number(value: String, name: &'static str, bad: bool, t: Tokens) -> Div {
127 stack(space::XXS)127 stack(space::XXS)
128 .flex_1()128 .flex_1()
129 .child(129 .child(
@@ -438,7 +438,7 @@ fn watching(watching: &[(Id, Kind, WatchStats)], chat: &Chat, t: Tokens) -> Opti
438 )438 )
439 }439 }
440 440
441-fn kind_word(kind: Kind) -> &'static str {441+pub(super) fn kind_word(kind: Kind) -> &'static str {
442 match kind {442 match kind {
443 Kind::Camera => "camera",443 Kind::Camera => "camera",
444 Kind::Screen => "screen",444 Kind::Screen => "screen",
@@ -463,14 +463,14 @@ pub fn rate(kbps: u32) -> String {
463 }463 }
464 }464 }
465 465
466-fn engine_label(engine: Engine) -> &'static str {466+pub(super) fn engine_label(engine: Engine) -> &'static str {
467 match engine {467 match engine {
468 Engine::Hardware => "hardware",468 Engine::Hardware => "hardware",
469 Engine::Software => "software",469 Engine::Software => "software",
470 }470 }
471 }471 }
472 472
473-fn resolution_text(layer: Layer, fps: f32) -> String {473+pub(super) fn resolution_text(layer: Layer, fps: f32) -> String {
474 format!(474 format!(
475 "{}p {}",475 "{}p {}",
476 layer.quality.resolution.height(),476 layer.quality.resolution.height(),
crates/client/src/gui/wave.rsmodified+1 -8
@@ -5,10 +5,7 @@ use gpui_kit::{
5 Div, Hsla, IntoElement, ParentElement, PathBuilder, Styled, canvas, div, point, px,5 Div, Hsla, IntoElement, ParentElement, PathBuilder, Styled, canvas, div, point, px,
6 };6 };
7 7
8-use super::{8+use super::style::{radius, stroke};
9- style::{radius, stroke},
10- voice_stats::SAMPLE_HISTORY,
11-};
12 9
13 use crate::net::Levels;10 use crate::net::Levels;
14 11
@@ -179,10 +176,6 @@ fn wave(bars: &[f32], size: f32, color: Hsla) -> Div {
179 }))176 }))
180 }177 }
181 178
182-pub fn line(levels: Vec<f32>, color: Hsla) -> impl IntoElement {
183- line_of(levels, SAMPLE_HISTORY, color)
184-}
185-
186 pub fn line_of(levels: Vec<f32>, slots: usize, color: Hsla) -> impl IntoElement {179 pub fn line_of(levels: Vec<f32>, slots: usize, color: Hsla) -> impl IntoElement {
187 canvas(180 canvas(
188 |_, _, _| {},181 |_, _, _| {},