How screwedinger/scoring-system works
Purpose and Entry Points
A browser-only, offline-capable live scoring system for Pounce & Bounce quiz events. The operator dashboard controls timing, pounces, bounce allocation, score commits, round rotation, and audit history; a separate projector view mirrors audience-safe state. App startup is src/main.tsx, mounting the primary React UI in src/App.tsx. The detached display is implemented by src/projector.tsx.
React Application Shell
src/App.tsx is the operator-facing orchestration layer and likely owns workflow screens/modals, keyboard interaction, and phase-driven rendering. Styling is split between application styles and global defaults:
• src/App.tsx
• src/App.css
• src/index.css
The Vite HTML entry is index.html; Vite configuration in vite.config.ts supplies the development/build boundary.
Central Stateful Quiz Engine
src/store.ts is the architectural core: a Zustand store with persisted browser state. It holds teams, scores, current round/question/turn, active workflow phase, pounce records, bounce selections/splits, timer state, and history/audit entries. Store actions enforce state transitions such as logging secret pounces, locking bounce eligibility, committing score deltas, advancing turns, and applying special rounds.
• src/store.ts
• src/types.ts
Persistence uses Zustand’s localStorage middleware, so the system has no server-side database or API dependency.
Question Lifecycle and Scoring Boundary
The main control flow is a staged question transaction:
1. Start/pause the pounce timer and record hidden pounce submissions.
2. Enter bounce mode, excluding teams that pounced.
3. Assign zero, one, or multiple bounce recipients and editable point splits.
4. Reveal and grade pounces only after bounce resolution.
5. Commit pounce outcomes, append ledger records, rotate the turn, and begin the next question.
The boundary between active scoring and committed scores is important: pounce intent is collected before its score impact is applied, preventing disclosure during the live question.
• src/App.tsx
• src/store.ts
• src/types.ts
Turn Rotation and Round Operations
Round progression is state-driven rather than dependent on a backend scheduler. The engine supports ordered direct-question turns and direction changes across rounds, while special rounds apply batch score deltas outside the normal question sequence. The same store should be treated as the source of truth for both score totals and the question-by-question audit trail.
• src/store.ts
• src/types.ts
• src/App.tsx
Projector Synchronization
The audience display is a separate browser-window runtime, rendered by src/projector.tsx. Operator and projector synchronize via the native BroadcastChannel API (quiz_display_channel per README), avoiding network infrastructure, WebSockets, or a server. This is an explicit presentation boundary: projector state should expose standings/current public context but not secret pounce data before resolution.
• src/projector.tsx
• src/App.tsx
• src/store.ts
Runtime and External Dependencies
The repository is a React 18 + TypeScript single-page application built and served with Vite. Browser platform services—localStorage and BroadcastChannel—provide persistence and inter-window communication. UI feedback uses lucide-react icons and canvas-confetti; deployment is compatible with static hosts such as Vercel. Dependency and script definitions are in package.json.
• package.json
• vite.config.ts
• src/main.tsx
Main entry points: store.ts Quiz state store · App.tsx Operator dashboard · main.tsx React bootstrap · vite.config.ts Vite build/runtime
Components 15
Operator app
- React bootstrap
src/main.tsx - Operator dashboard · Controls workflow phases, scoring, and operator interactions.
src/App.tsx - Application styles
src/App.css - Global styles
src/index.css
Quiz engine
- Quiz state store · Authoritative state, transitions, scores, and audit history.
src/store.ts - Quiz domain types
src/types.ts - Pounce transaction · Collects hidden pounces before their score impact is committed.
- Bounce allocation · Excludes pouncers and assigns recipients with point splits.
- Turn and round engine · Rotates direct turns, changes direction, and applies special rounds.
Audience display
- Projector view · Renders audience-safe standings and public question context.
src/projector.tsx
Browser platform
- Vite build/runtime
vite.config.ts - HTML entry
index.html - Persisted quiz state
- Display channel · quiz_display_channel synchronizes separate browser windows.
- Dependencies and scripts
package.json
Connections 16
- Dependencies and scripts → Vite build/runtime: defines
- Vite build/runtime → HTML entry: serves/builds
- HTML entry → React bootstrap: loads
- React bootstrap → Operator dashboard: mounts
- Operator dashboard → Application styles: uses
- React bootstrap → Global styles: loads
- Operator dashboard → Quiz state store: drives actions and renders state
- Quiz state store → Quiz domain types: uses
- Quiz state store → Pounce transaction: records and grades
- Pounce transaction → Bounce allocation: resolves before reveal
- Bounce allocation → Quiz state store: commits score deltas
- Quiz state store → Turn and round engine: applies progression
- Quiz state store → Persisted quiz state: persists via middleware
- Operator dashboard → Display channel: publishes public state
- Display channel → Projector view: synchronizes
- Quiz state store → Projector view: projects audience-safe state