Implement enter scores page with per-field and round validation

Each player gets a number input; scores are validated individually
(divisible by 5, ≤ 110) and as a round (must sum to −110). Submit
stays disabled until all constraints pass. A running sum indicator
turns green when the round is valid. Submitting appends the round
to game state and persists it to localStorage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 21:25:21 -05:00
parent 813d18e133
commit 9201273dc4
4 changed files with 96 additions and 6 deletions
+5 -2
View File
@@ -37,12 +37,15 @@ export default function App() {
setPage('scoresheet')
}
function handleSubmitScores() {
function handleSubmitScores(scores: number[]) {
const updated: GameState = { ...game!, rounds: [...game!.rounds, scores] }
saveGame(updated)
setGame(updated)
setPage('scoresheet')
}
if (page === 'title') return <TitleScreen onNewGame={handleNewGame} />
if (page === 'setup') return <PlayerSetup onStart={handleStart} />
if (page === 'scoresheet') return <ScoreSheet game={game!} onScoreRound={() => setPage('enterscores')} onNewGame={handleNewGame} />
if (page === 'enterscores') return <EnterScores onSubmit={handleSubmitScores} />
if (page === 'enterscores') return <EnterScores game={game!} onSubmit={handleSubmitScores} />
}