Fixed league/practice menus

This commit is contained in:
corey@blaishome.online
2025-02-16 16:07:49 -05:00
parent 0d05370cb9
commit a2ff6c9449
5 changed files with 266 additions and 81 deletions

View File

@@ -22,22 +22,24 @@ const initialState = {
const scoreReducer = (state, action) => {
switch (action.type) {
case ACTIONS.START_GAME:
case ACTIONS.START_NEW_ROUND:
return {
...state,
currentGame: {
...initialState.currentGame,
gameType: action.payload.gameType,
isLeague: action.payload.isLeague,
date: new Date().toISOString()
}
rounds: [],
totalScore: 0,
totalBullseyes: 0,
dateStarted: new Date().toISOString(),
},
};
case ACTIONS.ADD_ROUND:
const updatedRounds = [...state.currentGame.rounds];
updatedRounds[action.payload.roundIndex] = {
arrows: action.payload.arrows,
total: action.payload.arrows.reduce((sum, arrow) => sum + arrow.score, 0),
total: action.payload.total,
bullseyes: action.payload.arrows.filter(arrow => arrow.isBullseye).length
};
@@ -51,7 +53,7 @@ const scoreReducer = (state, action) => {
rounds: updatedRounds,
totalScore,
totalBullseyes
}
},
};
case ACTIONS.SAVE_GAME: