Files
joshuaandClaude Opus 5.5 bf5b6194f6 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>
2026-10-03 22:14:10 +02:00

15 lines
770 B
SQL

-- Game Night Live — countdown timer for the scoreboard.
-- One timer per event, set from the control room. Run after 0001_init.sql.
--
-- State is stored so that any screen can work out the time left on its own:
-- running : timer_ends_at is set (time left = timer_ends_at - now)
-- paused : timer_ends_at is null, timer_remaining_ms holds what was left
-- reset : timer_ends_at is null, timer_remaining_ms is null (= full duration)
alter table events
add column timer_visible boolean not null default false,
add column timer_duration_ms int not null default 60000
check (timer_duration_ms between 1000 and 86400000),
add column timer_remaining_ms int check (timer_remaining_ms >= 0),
add column timer_ends_at timestamptz;