Voice 16: Sidebar voice participants (#77) #112

Manually merged
charles merged 0 commits from voice-16-ui-voice-sidebar into voice 2026-11-11 19:59:27 +00:00
Owner

Stacked on: voice-6-core-voice-states (Voice 6, #67)

What this builds

The voice part of the channel sidebar (spec §9 "Sidebar", facts §7), cloned from VoiceParticipantsList, VoiceParticipantItem, GroupedVoiceParticipant, VoiceStateIcons, VoiceChannelUserCount, CollapsedCategoryVoiceParticipants, AvatarWithPresence and AvatarStack of the fork (every size constant names its CSS rule).

  • screens/main/voice_participants.rs: channel(&App, channel_id, &State) -> VoiceChannelModel (the testable half, from voice_channel_participants): one row per user with avatar, speaking ring and state icons; a user on several devices is one row with a "(N)" button that shows one row per device ("Desktop device" / "Mobile device"); stack + collapsed_category / collapsed_channel draw the avatar stack (5, then "+N") of a collapsed category; user_count_badge.
  • widgets/speaking_ring.rs: the #22c55e ring, min(3px, 10 %) wide, painted outside the avatar like the CSS outline (no layout room).
  • widgets/voice_state_icons.rs: camera, microphone, speaker, LIVE in the original's order, colours and tooltips.
  • sidebar.rs: a click on a voice channel emits Message::JoinVoice -> UserAction::JoinVoice { guild_id, channel_id }, or SelectChannel when the user is in it; a right-click on a participant emits Message::OpenParticipantMenu { user_id, connection_id, position }; a click on a category collapses it (selected, unread and connected channels stay).
  • theme/icons.rs: SpeakerSlash, VideoCamera (fill), Desktop, DeviceMobile (regular), from @phosphor-icons/react 2.1.10.

How it was tested

  • crates/fluxer-ui/tests/voice_sidebar.rs (headless, tiny-skia; not on Windows, #93): rows_show_state_icons, speaking_ring_follows_selector (also checks the drawn ring's pixel), click_joins_then_second_click_selects, grouped_devices_expand, collapsed_category_shows_who_is_in_its_voice_channels. Clicks are found by probing the sidebar with real mouse events, not by layout indexes.
  • Unit tests of the pure rules in the three new modules (they run on Windows too).
  • Screenshot sidebar_voice (fixtures/golden/sidebar_voice.png), drawn on lavapipe in the Ubuntu 22.04 container of docs/screenshots/README.md; the three existing goldens are unchanged.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally.

sidebar_voice

No reference capture of the Electron sidebar with voice participants exists in the fork's docs/assets; the dimensions come from the CSS modules named above.

Deviations from the plan

  • Branch name: pushed as voice-16-ui-voice-sidebar; voice/16-... cannot exist on the remote next to the voice branch (refname conflict), same as Voice 1, 2, 3 and 6.
  • fluxer-core touched (one variant): UserAction::JoinVoice is produced by Voice 7, which this task is not stacked on. It is added here with exactly the shape of Task 7's Interfaces block and no reducer. Voice 7 adds the same variant: when the two meet, keep one.
  • "Connected there" is "the user has a voice state in the channel" until the store has the client's own connection (Voice 7).
  • Device expander is the original's "(N)" button with the "Show N devices" / "Hide N devices" tooltip, not an "N more devices" row.
  • connection_id is Option<String> in OpenParticipantMenu: None on the row of a user on several devices (the original opens the menu for the user as a whole there).
  • User count badge is built but never shows: fluxer_proto::Channel has no user_limit (#107).
  • Collapsing categories did not exist; it is added as view state so that the collapsed-category avatars can show. Outside the task's Files list for that and the wiring: screens/main/{mod.rs,model.rs} (messages, category_id), app.rs (Local::sidebar), widgets/mod.rs, tests/{common/mod.rs,screenshots.rs}, READMEs.
  • The screenshot is built from fixtures (as the existing ones), not the devserver voice scenario (Voice 15 is not in the base).
  • Deferred items are in #111.

Closes #77

🤖 Generated with Claude Code

Stacked on: `voice-6-core-voice-states` (Voice 6, #67) ## What this builds The voice part of the channel sidebar (spec §9 "Sidebar", facts §7), cloned from `VoiceParticipantsList`, `VoiceParticipantItem`, `GroupedVoiceParticipant`, `VoiceStateIcons`, `VoiceChannelUserCount`, `CollapsedCategoryVoiceParticipants`, `AvatarWithPresence` and `AvatarStack` of the fork (every size constant names its CSS rule). - `screens/main/voice_participants.rs`: `channel(&App, channel_id, &State) -> VoiceChannelModel` (the testable half, from `voice_channel_participants`): one row per user with avatar, speaking ring and state icons; a user on several devices is one row with a "(N)" button that shows one row per device ("Desktop device" / "Mobile device"); `stack` + `collapsed_category` / `collapsed_channel` draw the avatar stack (5, then "+N") of a collapsed category; `user_count_badge`. - `widgets/speaking_ring.rs`: the `#22c55e` ring, `min(3px, 10 %)` wide, painted outside the avatar like the CSS outline (no layout room). - `widgets/voice_state_icons.rs`: camera, microphone, speaker, LIVE in the original's order, colours and tooltips. - `sidebar.rs`: a click on a voice channel emits `Message::JoinVoice` -> `UserAction::JoinVoice { guild_id, channel_id }`, or `SelectChannel` when the user is in it; a right-click on a participant emits `Message::OpenParticipantMenu { user_id, connection_id, position }`; a click on a category collapses it (selected, unread and connected channels stay). - `theme/icons.rs`: `SpeakerSlash`, `VideoCamera` (fill), `Desktop`, `DeviceMobile` (regular), from `@phosphor-icons/react` 2.1.10. ## How it was tested - `crates/fluxer-ui/tests/voice_sidebar.rs` (headless, tiny-skia; not on Windows, #93): `rows_show_state_icons`, `speaking_ring_follows_selector` (also checks the drawn ring's pixel), `click_joins_then_second_click_selects`, `grouped_devices_expand`, `collapsed_category_shows_who_is_in_its_voice_channels`. Clicks are found by probing the sidebar with real mouse events, not by layout indexes. - Unit tests of the pure rules in the three new modules (they run on Windows too). - Screenshot `sidebar_voice` (`fixtures/golden/sidebar_voice.png`), drawn on lavapipe in the Ubuntu 22.04 container of `docs/screenshots/README.md`; the three existing goldens are unchanged. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. ![sidebar_voice](https://git.forked.io/charles/fluxer-native/raw/branch/voice-16-ui-voice-sidebar/docs/screenshots/sidebar-voice.png) No reference capture of the Electron sidebar with voice participants exists in the fork's docs/assets; the dimensions come from the CSS modules named above. ## Deviations from the plan - **Branch name**: pushed as `voice-16-ui-voice-sidebar`; `voice/16-...` cannot exist on the remote next to the `voice` branch (refname conflict), same as Voice 1, 2, 3 and 6. - **`fluxer-core` touched** (one variant): `UserAction::JoinVoice` is produced by Voice 7, which this task is not stacked on. It is added here with exactly the shape of Task 7's Interfaces block and no reducer. Voice 7 adds the same variant: when the two meet, keep one. - **"Connected there"** is "the user has a voice state in the channel" until the store has the client's own connection (Voice 7). - **Device expander** is the original's "(N)" button with the "Show N devices" / "Hide N devices" tooltip, not an "N more devices" row. - **`connection_id` is `Option<String>`** in `OpenParticipantMenu`: `None` on the row of a user on several devices (the original opens the menu for the user as a whole there). - **User count badge** is built but never shows: `fluxer_proto::Channel` has no `user_limit` (#107). - **Collapsing categories** did not exist; it is added as view state so that the collapsed-category avatars can show. Outside the task's Files list for that and the wiring: `screens/main/{mod.rs,model.rs}` (messages, `category_id`), `app.rs` (`Local::sidebar`), `widgets/mod.rs`, `tests/{common/mod.rs,screenshots.rs}`, READMEs. - The screenshot is built from fixtures (as the existing ones), not the devserver `voice` scenario (Voice 15 is not in the base). - Deferred items are in #111. Closes #77 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The variant with the shape the Voice plan gives it in Task 7; nothing acts on
it until the connection machine of that task.

Refs #77

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Under each voice channel: the people in it with avatar, speaking ring and
state icons, the devices of a user on several behind a "(N)" button, the
user count badge, and a row of avatars while the category is collapsed.
Clicking a voice channel joins it, or opens it when the user is in it; a
right-click on a participant asks for the participant menu.

Refs #77

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
test(ui): sidebar_voice golden drawn on lavapipe
Some checks failed
ci / Linux (x86_64) (push) Has been cancelled
ci / Windows (x64) (push) Has been cancelled
ci / Linux (x86_64) (pull_request) Has been cancelled
ci / Windows (x64) (pull_request) Has been cancelled
64598a0c0a
The golden redrawn on the reference renderer (Ubuntu 22.04 lavapipe, the
recipe of docs/screenshots/README.md), and the same frame under
docs/screenshots for the PR.

Refs #77

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
Owner

Independent review: Voice 16 (sidebar voice participants), head 64598a0

Reviewed d245b6f..64598a0 only (3 commits, 22 files).

Verdict: APPROVED. 0 blocking, 4 minor.

What was checked

  1. Tests named by the plan: all four exist in crates/fluxer-ui/tests/voice_sidebar.rs and assert what the plan says: rows_show_state_icons (icons and tones per user, driven through VOICE_STATE_UPDATE), speaking_ring_follows_selector (model follows the selector's speaking, suppressed when muted; ring width 2.4 / 2.8 / 3.0 px; drawn pixel is #22c55e), click_joins_then_second_click_selects (first click JoinVoice { Some(GUILD), HANGOUT }, second SelectChannel, someone else being there does not count), grouped_devices_expand. Screenshot sidebar_voice exists with its golden.
  2. Interfaces: UserAction::JoinVoice { guild_id: Option<Snowflake>, channel_id: Snowflake } is identical to the variant on origin/voice-7-core-voice-connection. Message::OpenParticipantMenu { user_id, connection_id, position } exists with those field names. Participants come from voice_channel_participants, the count from voice_channel_user_count.
  3. Invariants: fluxer-core change is one enum variant, no new imports or dependencies. fluxer-ui does no I/O. No unwrap/expect/indexing on server data in the new non-test code (tree.children[0] is the widget's own child). No secrets; connection ids in fixtures are invented words.
  4. Review Focus: none of the seven items belongs to this task.
  5. CI: cargo xtask ci in the review worktree: exit 0. In addition the four ignored screenshot tests pass locally (cargo test -p fluxer-ui --test screenshots -- --ignored), including sidebar_voice_matches_golden.

Behaviour was compared with the fork: ChannelItem.handleSelect, GroupedVoiceParticipant (any/all aggregation of icons), ChannelListContent (category stack hidden when the user is connected in the group), VoiceStateIcons order. They match.

Findings

  1. minor — crates/fluxer-ui/src/screens/main/voice_participants.rs (Surface::update): OpenParticipantMenu.position is documented as "in the window", but the rows sit inside the sidebar's scrollable, and iced 0.14 hands children cursor + scroll translation (iced_widget-0.14.2/src/scrollable.rs:800). Once the channel list is scrolled, the published position is off by the scroll offset, so Task 20's menu would open below the cursor. The test only checks the unscrolled case. Fix here or in Task 20 (for example by taking the position from a window-level cursor), but Task 20 must not trust it as is.
  2. minor — same file, avatar_stack: the outline colour is read from DARK.colors.background_tertiary instead of the active theme (theme.colors() in the style closure), so the collapsed-category stack would keep the dark outline under another theme.
  3. minor — plan deviations, all disclosed in the PR and verified: the screenshot is built from fixtures, not the devserver voice scenario (Voice 15 not in base); the user count badge is implemented but can never show (user_limit always None, follow-up #107, open); the expander is the original's "(N)" button, not an "N more devices" row; connected means "the user has a voice state in the channel", which is also true from another device, until Voice 7 (follow-up #111, open). Files outside the plan's list were needed for the wiring.
  4. minor — crates/fluxer-core/src/event.rs: UserAction::JoinVoice is added here and by Voice 7. The definitions are identical, so the integrator keeps one at merge; the doc comment here ("the store ignores it") goes away with that.

Note for the integrator: tests/voice_sidebar.rs takes about 25 s in debug (the click probe rebuilds the view per grid point); acceptable, but it is the slowest UI test binary now.

## Independent review: Voice 16 (sidebar voice participants), head 64598a0 Reviewed `d245b6f..64598a0` only (3 commits, 22 files). **Verdict: APPROVED. 0 blocking, 4 minor.** ### What was checked 1. **Tests named by the plan**: all four exist in `crates/fluxer-ui/tests/voice_sidebar.rs` and assert what the plan says: `rows_show_state_icons` (icons and tones per user, driven through `VOICE_STATE_UPDATE`), `speaking_ring_follows_selector` (model follows the selector's `speaking`, suppressed when muted; ring width 2.4 / 2.8 / 3.0 px; drawn pixel is `#22c55e`), `click_joins_then_second_click_selects` (first click `JoinVoice { Some(GUILD), HANGOUT }`, second `SelectChannel`, someone else being there does not count), `grouped_devices_expand`. Screenshot `sidebar_voice` exists with its golden. 2. **Interfaces**: `UserAction::JoinVoice { guild_id: Option<Snowflake>, channel_id: Snowflake }` is identical to the variant on `origin/voice-7-core-voice-connection`. `Message::OpenParticipantMenu { user_id, connection_id, position }` exists with those field names. Participants come from `voice_channel_participants`, the count from `voice_channel_user_count`. 3. **Invariants**: `fluxer-core` change is one enum variant, no new imports or dependencies. `fluxer-ui` does no I/O. No `unwrap`/`expect`/indexing on server data in the new non-test code (`tree.children[0]` is the widget's own child). No secrets; connection ids in fixtures are invented words. 4. **Review Focus**: none of the seven items belongs to this task. 5. **CI**: `cargo xtask ci` in the review worktree: exit 0. In addition the four ignored screenshot tests pass locally (`cargo test -p fluxer-ui --test screenshots -- --ignored`), including `sidebar_voice_matches_golden`. Behaviour was compared with the fork: `ChannelItem.handleSelect`, `GroupedVoiceParticipant` (any/all aggregation of icons), `ChannelListContent` (category stack hidden when the user is connected in the group), `VoiceStateIcons` order. They match. ### Findings 1. **minor** — `crates/fluxer-ui/src/screens/main/voice_participants.rs` (`Surface::update`): `OpenParticipantMenu.position` is documented as "in the window", but the rows sit inside the sidebar's `scrollable`, and iced 0.14 hands children `cursor + scroll translation` (`iced_widget-0.14.2/src/scrollable.rs:800`). Once the channel list is scrolled, the published position is off by the scroll offset, so Task 20's menu would open below the cursor. The test only checks the unscrolled case. Fix here or in Task 20 (for example by taking the position from a window-level cursor), but Task 20 must not trust it as is. 2. **minor** — same file, `avatar_stack`: the outline colour is read from `DARK.colors.background_tertiary` instead of the active theme (`theme.colors()` in the style closure), so the collapsed-category stack would keep the dark outline under another theme. 3. **minor** — plan deviations, all disclosed in the PR and verified: the screenshot is built from fixtures, not the devserver `voice` scenario (Voice 15 not in base); the user count badge is implemented but can never show (`user_limit` always `None`, follow-up #107, open); the expander is the original's "(N)" button, not an "N more devices" row; `connected` means "the user has a voice state in the channel", which is also true from another device, until Voice 7 (follow-up #111, open). Files outside the plan's list were needed for the wiring. 4. **minor** — `crates/fluxer-core/src/event.rs`: `UserAction::JoinVoice` is added here and by Voice 7. The definitions are identical, so the integrator keeps one at merge; the doc comment here ("the store ignores it") goes away with that. Note for the integrator: `tests/voice_sidebar.rs` takes about 25 s in debug (the click probe rebuilds the view per grid point); acceptable, but it is the slowest UI test binary now.
Merge remote-tracking branch 'origin/voice' into voice/16-ui-voice-sidebar
All checks were successful
ci / Windows (x64) (push) Successful in 8m28s
ci / Linux (x86_64) (push) Successful in 25m15s
ci / Linux (x86_64) (pull_request) Successful in 25m20s
ci / Windows (x64) (pull_request) Successful in 8m33s
793da8ce2f
charles manually merged commit b6c6251df2 into voice 2026-11-11 19:59:27 +00:00
Sign in to join this conversation.
No description provided.