Text chat 59: Soundboard popout parity: preview, icons, custom emoji, edit, delete confirmation, trimmer (#388) #412

Manually merged
charles merged 2 commits from textchat-59-ui-soundboard-popout-parity into textchat 2026-11-13 06:36:48 +00:00
Owner

Text chat 59: soundboard popout parity with SoundboardPicker.tsx, GuildSoundboardSoundModal.tsx (edit mode) and EntranceSoundTrimmerModal.tsx.

Stacked on: textchat-56-core-soundboard-parity

What is built (fluxer-ui only)

  • Preview (#141): each available tile has a play button ("Preview {name}") sending PreviewSound with the sound's own volume; it works while sends are blocked (muted, cooldown).
  • Guild icons / custom emoji (#141): section titles show the guild icon (16 px, guild_icon_url, acronym until loaded) or the favourites star; tiles draw custom emoji (media_urls::custom_emoji through widgets::emoji::url) and Twemoji through Images. soundboard::wanted feeds media::wanted while the popout is open.
  • Live cooldown (#138): the notice reads PickerModel::cooldown on every snapshot (3 → 2 → 1 s test).
  • Edit / delete for any guild (#140): the sound menu offers "Edit sound" and "Delete sound" when selectors::can_manage_sound; "Upload a sound" uses can_upload_sound. The old inline rename is replaced by the edit dialog.
  • Delete confirmation (#139): confirm.rs (generic Confirm, reused by Task 60), the original's "Delete sound" / "Delete {name}? Members will no longer be able to play it." / Cancel / red Delete; only Delete emits DeleteSound.
  • Edit dialog (edit.rs): name with the original's three errors, related emoji (EmojiField: grid of the guild's custom emoji + Unicode from emoji_picker, search, a typed emoji offered first, Remove emoji), volume slider + Preview at the slider's volume, Save → EditSound (closes without sending when nothing changed; closes when the store's sound matches what was saved via State::sync; shows "Couldn't save this sound" + body on failure). The upload dialog uses the same emoji field.
  • Trimmer (trimmer.rs): Config with SOUNDBOARD / ENTRANCE, waveform from SoundFileReader::outline, two draggable handles (or the region; min 0.1 s, max Config::max, the original's clamping), readout "Selection: … (max …)", Play selection (trim → PreviewLocalSound) / Pause (StopPreview), Use selection (trim; over-size error with formatFileSize-style "1MB"/"20MB"), decode error. The upload dialog runs every file through it before UploadSound.
  • files.rs: FileError::Unsupported, SoundOutline, SoundFileReader::{outline, trim} with default bodies returning Unsupported (the platform implementation is Task 61).

Tests

  • cargo test -p fluxer-ui --test soundboard: all 19 plan tests plus edit_dialog_shows_the_original_failure; existing upload tests now go through the trimmer.
  • Screenshots (new): soundboard_popout_icons_preview, soundboard_delete_confirm, soundboard_edit_sound, sound_trimmer; soundboard_popout regenerated (preview buttons, acronyms). Goldens rendered on lavapipe in the Ubuntu 22.04 image (fluxer-native-shots:u2204); all 55 screenshot tests pass there and on this machine's GPU.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally.

Deviations / notes for review

  • trimmer::Outcome also has None and Action(UserAction) (for the preview and its stop); upload::Outcome::Action became Actions(Vec<UserAction>); State::escape/close return the StopPreview of a playing trimmer.
  • Touched screens/main/mod.rs (outside the Files list): the popout now needs the image cache, and dialogs are drawn centred over the whole call area with a dim backdrop (soundboard::dialog), since the edit dialog is taller than the popout.
  • The edit screenshot searches the grid for "blob": Unicode glyphs come from system fonts and differ between machines.
  • Custom emoji images are not in the devserver's fixture pictures, so they render blank in goldens; no Electron side-by-side (no access to the live instance from here). Playhead over the waveform left out (the store has no clip position).
  • Known flaky apps/fluxer lib SIGABRT at exit (#338) seen once on the base.

Also closes #138, closes #139, closes #140, closes #141.

Closes #388

🤖 Generated with Claude Code

Text chat 59: soundboard popout parity with `SoundboardPicker.tsx`, `GuildSoundboardSoundModal.tsx` (edit mode) and `EntranceSoundTrimmerModal.tsx`. Stacked on: textchat-56-core-soundboard-parity ## What is built (fluxer-ui only) - **Preview** (#141): each available tile has a play button ("Preview {name}") sending `PreviewSound` with the sound's own volume; it works while sends are blocked (muted, cooldown). - **Guild icons / custom emoji** (#141): section titles show the guild icon (16 px, `guild_icon_url`, acronym until loaded) or the favourites star; tiles draw custom emoji (`media_urls::custom_emoji` through `widgets::emoji::url`) and Twemoji through `Images`. `soundboard::wanted` feeds `media::wanted` while the popout is open. - **Live cooldown** (#138): the notice reads `PickerModel::cooldown` on every snapshot (3 → 2 → 1 s test). - **Edit / delete for any guild** (#140): the sound menu offers "Edit sound" and "Delete sound" when `selectors::can_manage_sound`; "Upload a sound" uses `can_upload_sound`. The old inline rename is replaced by the edit dialog. - **Delete confirmation** (#139): `confirm.rs` (generic `Confirm`, reused by Task 60), the original's "Delete sound" / "Delete {name}? Members will no longer be able to play it." / Cancel / red Delete; only Delete emits `DeleteSound`. - **Edit dialog** (`edit.rs`): name with the original's three errors, related emoji (`EmojiField`: grid of the guild's custom emoji + Unicode from `emoji_picker`, search, a typed emoji offered first, Remove emoji), volume slider + Preview at the slider's volume, Save → `EditSound` (closes without sending when nothing changed; closes when the store's sound matches what was saved via `State::sync`; shows "Couldn't save this sound" + body on failure). The upload dialog uses the same emoji field. - **Trimmer** (`trimmer.rs`): `Config` with `SOUNDBOARD` / `ENTRANCE`, waveform from `SoundFileReader::outline`, two draggable handles (or the region; min 0.1 s, max `Config::max`, the original's clamping), readout "Selection: … (max …)", Play selection (trim → `PreviewLocalSound`) / Pause (`StopPreview`), Use selection (trim; over-size error with `formatFileSize`-style "1MB"/"20MB"), decode error. The upload dialog runs every file through it before `UploadSound`. - **files.rs**: `FileError::Unsupported`, `SoundOutline`, `SoundFileReader::{outline, trim}` with default bodies returning `Unsupported` (the platform implementation is Task 61). ## Tests - `cargo test -p fluxer-ui --test soundboard`: all 19 plan tests plus `edit_dialog_shows_the_original_failure`; existing upload tests now go through the trimmer. - Screenshots (new): `soundboard_popout_icons_preview`, `soundboard_delete_confirm`, `soundboard_edit_sound`, `sound_trimmer`; `soundboard_popout` regenerated (preview buttons, acronyms). Goldens rendered on lavapipe in the Ubuntu 22.04 image (`fluxer-native-shots:u2204`); all 55 screenshot tests pass there and on this machine's GPU. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. ## Deviations / notes for review - `trimmer::Outcome` also has `None` and `Action(UserAction)` (for the preview and its stop); `upload::Outcome::Action` became `Actions(Vec<UserAction>)`; `State::escape`/`close` return the `StopPreview` of a playing trimmer. - Touched `screens/main/mod.rs` (outside the Files list): the popout now needs the image cache, and dialogs are drawn centred over the whole call area with a dim backdrop (`soundboard::dialog`), since the edit dialog is taller than the popout. - The edit screenshot searches the grid for "blob": Unicode glyphs come from system fonts and differ between machines. - Custom emoji images are not in the devserver's fixture pictures, so they render blank in goldens; no Electron side-by-side (no access to the live instance from here). Playhead over the waveform left out (the store has no clip position). - Known flaky `apps/fluxer` lib SIGABRT at exit (#338) seen once on the base. Also closes #138, closes #139, closes #140, closes #141. Closes #388 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Independent review: Text chat 59 (diff 8784e9c..3f1f325)

Tests (plan step 1): all 19 named tests exist in crates/fluxer-ui/tests/soundboard.rs and assert what the plan says. I checked the strings against the fork: GuildSoundboardTab.tsx:146-150 (delete confirm), GuildSoundboardSoundModal.tsx:55-92 (name errors and save failure) and EntranceSoundTrimmerModal.tsx:31-57 (trimmer strings). The cooldown test goes 3 → 2 → 1 s with 400 ms and 1 s ticks. The trimmer limits are 5.2 s / 1 MiB / mono and 30 s / 20 MiB / stereo, with a 0.1 s minimum. There is one extra test, edit_dialog_shows_the_original_failure. All 4 named screenshots exist with goldens.

Interfaces: FileError::Unsupported, files::SoundOutline and SoundFileReader::{outline, trim} (default bodies return Unsupported) match the plan exactly. So do trimmer::{Config, SOUNDBOARD, ENTRANCE} and confirm. trimmer::Outcome adds None and Action(UserAction) to the planned variants. That is additive: Task 60 builds against the merged code, so nothing breaks.

Invariants: fluxer-core is untouched and there are no new dependencies. The UI gains no new I/O path: outline and trim run only through Task::perform on the injected reader, from app.rs. Nothing is logged, and no path or URL is logged. The sounds built inline in the screenshot test have the same keys as fixtures/rest/soundboard_sounds.json. I checked the trimmer and waveform maths for panics: they are clamped, the slice indices stay in bounds, Duration::from_secs_f64 never gets a negative value, and an empty or zero peak list is handled.

Findings

  • minor: until Task 61 injects AppSoundFiles (outline and trim over fluxer_audio::edit), the shipped app uses the default Unsupported reader. Every soundboard upload in the real client would stop at "Could not decode this audio file." in the trimmer. The previews and PlayClipBytes also need Task 61's runtime. The plan stages it this way, but Charles should not test uploads on a build between this merge and Task 61.
  • minor: trimmer::State::playing stays true after a preview ends by itself, because the model ANDs it with the store's previewing. The next selection change or Escape then sends a harmless extra StopPreview for the preview tag.
  • minor: after a save, the edit dialog closes only when the stored sound equals the form (name trimmed, volume within 0.005). If the server normalises the name in any other way, the dialog stays open with nothing showing it saved, and the user has to press Cancel.

Review Focus: none of the items 1-7 belongs to this task. Item 7 (server data never panics) was checked above.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed (exit 0). All 55 golden tests passed, including the 4 new ones and the regenerated soundboard_popout.

Verdict: APPROVE. No blocking findings.

## Independent review: Text chat 59 (diff 8784e9c..3f1f325) **Tests (plan step 1):** all 19 named tests exist in `crates/fluxer-ui/tests/soundboard.rs` and assert what the plan says. I checked the strings against the fork: `GuildSoundboardTab.tsx:146-150` (delete confirm), `GuildSoundboardSoundModal.tsx:55-92` (name errors and save failure) and `EntranceSoundTrimmerModal.tsx:31-57` (trimmer strings). The cooldown test goes 3 → 2 → 1 s with 400 ms and 1 s ticks. The trimmer limits are 5.2 s / 1 MiB / mono and 30 s / 20 MiB / stereo, with a 0.1 s minimum. There is one extra test, `edit_dialog_shows_the_original_failure`. All 4 named screenshots exist with goldens. **Interfaces:** `FileError::Unsupported`, `files::SoundOutline` and `SoundFileReader::{outline, trim}` (default bodies return Unsupported) match the plan exactly. So do `trimmer::{Config, SOUNDBOARD, ENTRANCE}` and `confirm`. `trimmer::Outcome` adds `None` and `Action(UserAction)` to the planned variants. That is additive: Task 60 builds against the merged code, so nothing breaks. **Invariants:** fluxer-core is untouched and there are no new dependencies. The UI gains no new I/O path: outline and trim run only through `Task::perform` on the injected reader, from `app.rs`. Nothing is logged, and no path or URL is logged. The sounds built inline in the screenshot test have the same keys as `fixtures/rest/soundboard_sounds.json`. I checked the trimmer and waveform maths for panics: they are clamped, the slice indices stay in bounds, `Duration::from_secs_f64` never gets a negative value, and an empty or zero peak list is handled. **Findings** - minor: until Task 61 injects `AppSoundFiles` (outline and trim over `fluxer_audio::edit`), the shipped app uses the default `Unsupported` reader. Every soundboard upload in the real client would stop at "Could not decode this audio file." in the trimmer. The previews and `PlayClipBytes` also need Task 61's runtime. The plan stages it this way, but Charles should not test uploads on a build between this merge and Task 61. - minor: `trimmer::State::playing` stays `true` after a preview ends by itself, because the model ANDs it with the store's `previewing`. The next selection change or Escape then sends a harmless extra `StopPreview` for the preview tag. - minor: after a save, the edit dialog closes only when the stored sound equals the form (name trimmed, volume within 0.005). If the server normalises the name in any other way, the dialog stays open with nothing showing it saved, and the user has to press Cancel. **Review Focus:** none of the items 1-7 belongs to this task. Item 7 (server data never panics) was checked above. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: all steps passed (exit 0). All 55 golden tests passed, including the 4 new ones and the regenerated `soundboard_popout`. **Verdict: APPROVE.** No blocking findings.
Author
Owner

Independent review (second pass): Text chat 59 at d8fb09f (task commit 3f1f325)

Tests (plan step 1): All 19 named tests exist in crates/fluxer-ui/tests/soundboard.rs. All 4 screenshots exist as *_matches_golden in tests/screenshots.rs, with goldens. They assert the planned values:

  • the delete confirmation: "Delete sound" / "Cancel" / "Delete", danger style, and only Delete sends DeleteSound;
  • the cooldown notice counts 3 → 2 → 1 s;
  • the name errors read "Name is required" and "Name must be at least / {max} characters or fewer";
  • the trimmer configs: SOUNDBOARD is 30 s / 20 MiB / stereo, ENTRANCE is 5.2 s / 1 MiB / mono with the help line, and the minimum selection is 0.1 s.

Interfaces: These match the plan exactly: FileError::Unsupported, files::SoundOutline { duration, channels, peaks } and SoundFileReader::{outline, trim} with default Unsupported bodies. So do trimmer::{Config, SOUNDBOARD, ENTRANCE} and trimmer::Outcome::{Outline, Trim, Done, Cancel}. Outcome also has None and Action, which is additive.

Invariants: fluxer-core is untouched and there are no new dependencies. fluxer-ui gains no new I/O path: outline and trim run only through Task::perform on the injected reader. Nothing is logged, and no path or URL is logged. The trimmer's duration maths is clamped, so x_of guards a zero duration and move_end avoids clamp panics.

Findings

  • minor: edit.rs has MAX_CHOICES = 80, a cap that neither the plan nor the original's picker has. With nothing typed, the grid shows at most 80 entries. A guild with 80 or more custom emoji therefore shows no Unicode emoji, and some of its own emoji can be reached only by search. Charles's relayed request "remove the cap" may mean this cap. It has not been acted on and needs his confirmation.
  • minor: this repeats the previous review. Until Task 61 injects AppSoundFiles, the shipped app's reader returns Unsupported. Every upload goes through the trimmer, so in the real client every upload stops at "Could not decode this audio file." The plan stages it this way.
  • minor (not this task): on the first local run, fluxer-video bus_reader_never_blocks_writer failed because one write took 5.6 ms against a 5 ms limit while the machine was loaded. This is a timing flake in a crate this PR does not touch, and it passed on the re-run.

Review Focus: none of the items belongs to this task. I checked item 7 (no panics) for the trimmer maths.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci at d8fb09f: all steps passed (exit 0) on the re-run.

Verdict: APPROVE. There are no blocking findings.

## Independent review (second pass): Text chat 59 at d8fb09f (task commit 3f1f325) **Tests (plan step 1):** All 19 named tests exist in `crates/fluxer-ui/tests/soundboard.rs`. All 4 screenshots exist as `*_matches_golden` in `tests/screenshots.rs`, with goldens. They assert the planned values: - the delete confirmation: "Delete sound" / "Cancel" / "Delete", danger style, and only Delete sends `DeleteSound`; - the cooldown notice counts 3 → 2 → 1 s; - the name errors read "Name is required" and "Name must be at least / {max} characters or fewer"; - the trimmer configs: `SOUNDBOARD` is 30 s / 20 MiB / stereo, `ENTRANCE` is 5.2 s / 1 MiB / mono with the help line, and the minimum selection is 0.1 s. **Interfaces:** These match the plan exactly: `FileError::Unsupported`, `files::SoundOutline { duration, channels, peaks }` and `SoundFileReader::{outline, trim}` with default `Unsupported` bodies. So do `trimmer::{Config, SOUNDBOARD, ENTRANCE}` and `trimmer::Outcome::{Outline, Trim, Done, Cancel}`. `Outcome` also has `None` and `Action`, which is additive. **Invariants:** fluxer-core is untouched and there are no new dependencies. fluxer-ui gains no new I/O path: outline and trim run only through `Task::perform` on the injected reader. Nothing is logged, and no path or URL is logged. The trimmer's duration maths is clamped, so `x_of` guards a zero duration and `move_end` avoids `clamp` panics. **Findings** - minor: `edit.rs` has `MAX_CHOICES = 80`, a cap that neither the plan nor the original's picker has. With nothing typed, the grid shows at most 80 entries. A guild with 80 or more custom emoji therefore shows no Unicode emoji, and some of its own emoji can be reached only by search. Charles's relayed request "remove the cap" may mean this cap. It has not been acted on and needs his confirmation. - minor: this repeats the previous review. Until Task 61 injects `AppSoundFiles`, the shipped app's reader returns `Unsupported`. Every upload goes through the trimmer, so in the real client every upload stops at "Could not decode this audio file." The plan stages it this way. - minor (not this task): on the first local run, `fluxer-video` `bus_reader_never_blocks_writer` failed because one write took 5.6 ms against a 5 ms limit while the machine was loaded. This is a timing flake in a crate this PR does not touch, and it passed on the re-run. **Review Focus:** none of the items belongs to this task. I checked item 7 (no panics) for the trimmer maths. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` at d8fb09f: all steps passed (exit 0) on the re-run. **Verdict: APPROVE.** There are no blocking findings.
charles manually merged commit 5817ae684a into textchat 2026-11-13 06:36:48 +00:00
Sign in to join this conversation.
No description provided.