Add per-round edit button to scoresheet

A ✎ button next to each round label opens the score entry form
pre-populated with that round's scores. Submitting replaces the round
in place instead of appending a new one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 22:36:39 -05:00
parent 35c1694e18
commit aa121bbcf3
4 changed files with 38 additions and 7 deletions
+6 -2
View File
@@ -9,9 +9,10 @@ interface Props {
game: GameState
onScoreRound: () => void
onNewGame: () => void
onEditRound: (i: number) => void
}
export default function ScoreSheet({ game, onScoreRound, onNewGame }: Props) {
export default function ScoreSheet({ game, onScoreRound, onNewGame, onEditRound }: Props) {
const [confirmingNewGame, setConfirmingNewGame] = useState(false)
const totals = computeRunningTotals(game.rounds)
@@ -62,7 +63,10 @@ export default function ScoreSheet({ game, onScoreRound, onNewGame }: Props) {
{game.rounds.map((roundScores, i) => (
<Fragment key={i}>
<div className={styles.labelCell}>Round {i + 1}</div>
<div className={styles.labelCell}>
<button className={styles.editBtn} onClick={() => onEditRound(i)}></button>
Round {i + 1}
</div>
{roundScores.map((score, j) => (
<div key={j} className={styles.scoreCell + (j === winnerIndex ? ' ' + styles.winnerCell : '')}>{score}</div>
))}