voelin-gpui: centre the voice page's smaller stage while it fits

Make the compact stage scroll container a flex row (`.flex().flex_row()`) and mark its inner participant row `.flex_none().mx_auto()`, so 1–5 participants centre horizontally above the call bar when they fit while crowded channels (12–25+ people) still start at the left padding and scroll sideways without clipping the first participant.

Add a GPUI layout test pinning both cases (2 and 5 people centred, 25 people unclipped on the left and overflowing horizontally) and re-shoot the two compact screenshots at 1440×960.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
This commit is contained in:
faumarayandGemini 4 Neon committed 2026-11-23 08:26:14 +03:00
1 parent a16e4d4b93
commit 15a1b60d8a
4 files changed
+78

No files matched your search

+3
View File
@@ -597,9 +597,12 @@ impl Render for VoicePage {
.h(px(112.0))
.flex_none()
.overflow_x_scroll()
.flex()
.flex_row()
.child(
div()
.h_full()
.flex_none()
.mx_auto()
.flex()
.flex_row()
@@ -939,3 +939,78 @@ fn many_people_scroll_and_the_call_bar_stays_on_the_page(cx: &mut TestAppContext
let header = at(cx, "voice-header").expect("the header");
assert!(header.bottom() <= stage.top(), "the header stays on top");
}
/// On the smaller stage, a small channel (2–5 people) is centred horizontally
/// inside `"voice-people"`, while a crowded channel (20+ people) overflows
/// sideways starting cleanly at the left edge without clipping the first person.
#[gpui::test]
fn the_smaller_stage_centres_few_people_and_does_not_clip_many(cx: &mut TestAppContext) {
let (shell, cx) = on_the_voice_page(cx, Switches::default());
click(cx, "voice-stage");
assert!(shell.view.read_with(cx, |view, cx| view.voice_page().read(cx).compact_shown()));
let check_centred = |shell: &Shell, cx: &mut VisualTestContext, expected_len: usize| {
let list = people(shell, cx);
assert_eq!(list.len(), expected_len);
let stage = at(cx, "voice-people").expect("compact stage");
let first = at(cx, &format!("voice-member-{}", list.first().unwrap().id)).unwrap();
let last = at(cx, &format!("voice-member-{}", list.last().unwrap().id)).unwrap();
let left_gap = f32::from(first.left() - stage.left());
let right_gap = f32::from(stage.right() - last.right());
assert!(
(left_gap - right_gap).abs() < 2.0,
"{expected_len} people should be centred: left_gap={left_gap}, right_gap={right_gap}, stage={stage:?}, first={first:?}, last={last:?}"
);
assert!(left_gap > 50.0, "{expected_len} people should not sit flush left: {left_gap}");
assert!(first.left() >= stage.left() && last.right() <= stage.right());
};
// Five people (the sample channel).
check_centred(&shell, cx, 5);
// Two people: still centred with wider margins.
shell
.events
.send(sample_presence!(p => {
for id in [3u16, 4, 5] {
p.clients.remove(&id);
}
}))
.unwrap();
frame(cx);
check_centred(&shell, cx, 2);
// Twenty-five people: overflows sideways without clipping the first person off the left edge.
shell
.events
.send(sample_presence!(p => {
for id in 100..120u16 {
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);
let list = people(&shell, cx);
assert_eq!(list.len(), 25);
let stage = at(cx, "voice-people").expect("compact stage");
let first = at(cx, &format!("voice-member-{}", list.first().unwrap().id)).unwrap();
let last = at(cx, &format!("voice-member-{}", list.last().unwrap().id)).unwrap();
assert_eq!(stage.size.height, px(112.0));
assert_eq!(first.top(), last.top(), "stays one horizontal row");
assert!(
first.left() >= stage.left(),
"first participant must not be clipped left: first={first:?}, stage={stage:?}"
);
assert!(
f32::from(first.left() - stage.left()) <= 32.0,
"overflowing row starts at left padding: first={first:?}, stage={stage:?}"
);
assert!(
last.right() > stage.right(),
"25 people overflow horizontally to scroll: last={last:?}, stage={stage:?}"
);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB