Add scoreboard countdown timer and sound effects

- Timer: one per event, set from the control room (duration, presets,
  start/pause/resume/reset, show/hide, T shortcut). Rules are pure
  functions in src/lib/timer.ts; the server's clock sets the end time and
  each screen counts down locally, corrected for its own clock.
  Needs supabase/migrations/0002_timer.sql.
- Sound effects on the scoreboard, synthesised with Web Audio (no files):
  drum-roll + crash per revealed team, fanfare for first place, a chime
  on game change, ticks for the last 10 seconds and a buzzer at zero.
  Triggers are pure functions comparing consecutive payloads.
- 'Turn sound on' button on the scoreboard, since browsers block audio
  until a click; the choice is remembered across reloads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 22:14:10 +02:00
co-authored by Claude Opus 5.5
parent f1b3a862f8
commit bf5b6194f6
23 changed files with 1056 additions and 14 deletions
+21 -2
View File
@@ -62,7 +62,7 @@ This is the screen used during the night. Must be fast and hard to mess up.
Recent adjustments list with undo.
- Scoreboard visibility: **Visible / Frozen / Hidden** (see 4.3). Big obvious toggle.
- "Open scoreboard" button (new tab) + "Reveal mode" button (see 4.3).
- Keyboard shortcuts: `N` next game, `P` prev game, `H` cycle visibility, `?` help.
- Keyboard shortcuts: `N` next game, `P` prev game, `H` cycle visibility, `T` start/pause timer, `?` help.
### 4.3 Scoreboard (`/s/[token]`)
- Projector-first, 16:9, readable from the back of a hall.
@@ -89,6 +89,25 @@ This is the screen used during the night. Must be fast and hard to mess up.
- Open link (`/jo/[token]`): enter name → creates judge → redirects to personal link and stores it
in localStorage so a refresh keeps them in.
### 4.5 Timer
One countdown timer per event, run from the control room; not tied to a game.
- Set a time (minutes + seconds, or presets 30s / 1 min / 2 min / 5 min). Setting a time resets the timer.
- Start, pause, resume, reset. Show or hide it on the scoreboard; starting it also shows it.
- The scoreboard shows it large above the standings. It is not a score, so it shows whether
scores are visible, frozen or hidden.
- The last 10 seconds are highlighted; at zero it shows "Time's up" until reset.
- The server's clock decides when it ends, so every screen agrees even if a device clock is wrong.
- Keyboard shortcut in the control room: `T` start/pause.
### 4.6 Sound effects (scoreboard only)
Played by the scoreboard page, so they come out of the projector PC's speakers.
- Reveal: a drum-roll, then a crash as each team appears; a fanfare for first place.
- Game transition: a chime when the current game changes.
- Timer: a tick for each of the last 10 seconds (sharper for the last 3) and a buzzer at zero.
- Browsers only allow sound after a click on the page, so the scoreboard has a "Turn sound on"
button. The choice is remembered, but after a reload one click anywhere is needed again.
- Sounds are synthesised in the browser (no audio files). With reduced motion the drum-roll is skipped.
## 5. Non-functional
- Live latency target < 1s on normal Wi-Fi.
- Works with ~10 teams, ~20 games, ~10 judges per game without lag.
@@ -98,4 +117,4 @@ This is the screen used during the night. Must be fast and hard to mess up.
## 6. Out of scope (v1)
- Individual contestants within teams (stretch: `participants` per team).
- Multiple admins / co-hosts (stretch).
- Timers/buzzers (stretch).
- Per-game timers and buzzers for contestants (stretch). The event countdown timer is in 4.5.