diff --git a/crates/voelin-gpui/src/shell/voice.rs b/crates/voelin-gpui/src/shell/voice.rs index 1ac5ebf..868d479 100644 --- a/crates/voelin-gpui/src/shell/voice.rs +++ b/crates/voelin-gpui/src/shell/voice.rs @@ -616,7 +616,11 @@ impl Render for VoicePage { .id("voice-people") .debug_selector(|| "voice-people".into()) .w_full() - .flex_none() + // Rows taller than the page scroll; the header and the call bar keep + // their places. + .flex_shrink(1.0) + .min_h_0() + .overflow_y_scroll() .flex() .flex_row() .flex_wrap() diff --git a/crates/voelin-gpui/src/view/voice_tests.rs b/crates/voelin-gpui/src/view/voice_tests.rs index 5de8e3b..9928146 100644 --- a/crates/voelin-gpui/src/view/voice_tests.rs +++ b/crates/voelin-gpui/src/view/voice_tests.rs @@ -683,3 +683,32 @@ fn a_person_whose_sound_is_off_has_the_deafen_mark(cx: &mut TestAppContext) { frame(cx); assert!(at(cx, "voice-speaking-3").is_some() && at(cx, "voice-off-3").is_none()); } + +/// A channel with many people: the larger stage wraps them into rows and, when +/// the rows are taller than the page, scrolls them (the page's other parts stay +/// where they are: the header on top, the call bar under the people). +#[gpui::test] +fn many_people_scroll_and_the_call_bar_stays_on_the_page(cx: &mut TestAppContext) { + let (shell, cx) = on_the_voice_page(cx, Switches::default()); + shell + .events + .send(sample_presence!(p => { + for id in 100..140u16 { + let mut person = p.clients[&1].clone(); + person.id = id; + person.nickname = format!("Guest {id}"); + person.uid = Some(format!("guest-{id}")); + p.clients.insert(id, person); + } + })) + .unwrap(); + frame(cx); + assert_eq!(people(&shell, cx).len(), 45); + let page = at(cx, "voice-page").expect("the page"); + let bar = at(cx, "voice-callbar").expect("the call bar is still on the page"); + let stage = at(cx, "voice-people").expect("the people"); + assert!(bar.bottom() <= page.bottom(), "{bar:?} is inside {page:?}"); + assert!(stage.bottom() <= bar.top(), "the people end where the call bar begins"); + let header = at(cx, "voice-header").expect("the header"); + assert!(header.bottom() <= stage.top(), "the header stays on top"); +}