Phase 4: scoreboard page, public API and realtime refresh
- buildScoreboardPayload is the single place deciding what the public may see: visible, frozen (snapshot scores, live current game), hidden (no scores, alphabetical) and reveal (unrevealed teams carry no score/order). - GET /api/public/scoreboard/[token] validates the token, then loads the event with the service client in one parallel round trip. - notify() pings sb/admin/game channels over Realtime's REST endpoint with no data; useRefreshChannel refetches immediately on a ping, throttles bursts, and falls back to a 10s poll, focus and reconnect. - /s/[token]: FLIP rank animation, count-up totals, reduced motion, fullscreen, cursor hide and a connection indicator. - Admin setup actions now notify, so renames and reorders show up live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// Shared by the server (notify) and the browser (useRefreshChannel). See docs/ARCHITECTURE.md.
|
||||
export const REFRESH_EVENT = "refresh";
|
||||
|
||||
export const channelNames = {
|
||||
scoreboard: (scoreboardToken: string) => `sb:${scoreboardToken}`,
|
||||
game: (gameId: string) => `game:${gameId}`,
|
||||
admin: (eventId: string) => `admin:${eventId}`,
|
||||
};
|
||||
Reference in New Issue
Block a user