diff --git a/crates/client/src/gui/share_view.rs b/crates/client/src/gui/share_view.rs index 35f0a0e..5590829 100644 --- a/crates/client/src/gui/share_view.rs +++ b/crates/client/src/gui/share_view.rs @@ -24,7 +24,7 @@ use super::{ notify_error, pop_in, settings_page::segmented, text, - wave::wave, + wave::wave_slot, widget::{icon_button, spawn_warn}, }; use crate::{ @@ -485,16 +485,9 @@ impl Yumush { .bg(palette.panel) .occlude() .text_size(text(12.)) - .children( - audio - .then(|| { - self.chat - .waves - .share(viewer.user_id) - .map(|history| wave(history, 14., palette.alert)) - }) - .flatten(), - ) + .children(audio.then(|| { + wave_slot(self.chat.waves.share(viewer.user_id), 14., palette.alert) + })) .children(audio.then(|| { Icon::new(IconName::Volume2) .w(px(14.)) diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index 77facf5..b712e3b 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -30,7 +30,7 @@ use super::{ settings_page::{segment, segment_track}, social::Relation, voice_stats, - wave::wave, + wave::wave_slot, widget::{bare_input, compact_frame, icon_button}, }; @@ -288,12 +288,7 @@ impl Yumush { .text_color(palette.alert), ) }) - .children( - self.chat - .waves - .voice(user.id) - .map(|history| wave(history, 12., palette.ok)), - ), + .child(wave_slot(self.chat.waves.voice(user.id), 12., palette.ok)), ) } diff --git a/crates/client/src/gui/wave.rs b/crates/client/src/gui/wave.rs index c6ec039..9a1d383 100644 --- a/crates/client/src/gui/wave.rs +++ b/crates/client/src/gui/wave.rs @@ -89,7 +89,14 @@ impl Waves { } } -pub fn wave(history: &VecDeque, size: f32, color: Hsla) -> Div { +pub fn wave_slot(history: Option<&VecDeque>, size: f32, color: Hsla) -> Div { + div() + .flex_shrink_0() + .w(px(spectrum::BANDS as f32 * (BAR_WIDTH + 1.))) + .children(history.map(|history| wave(history, size, color))) +} + +fn wave(history: &VecDeque, size: f32, color: Hsla) -> Div { div() .flex() .items_center()