Working with menu button

This commit is contained in:
corey@blaishome.online
2025-02-13 22:51:56 -05:00
parent a1f4ef16bd
commit d349924695

View File

@@ -21,15 +21,11 @@ const ScoreTracker = () => {
}; };
// Handle Add Round, Game Completion, etc. // Handle Add Round, Game Completion, etc.
const handleGameEnd = () => { const handleGameEnd = () => {
// Navigate to the summary page after the game ends // Navigate to the summary page after the game ends
navigate('/summary'); navigate('/summary');
}; };
// Rest of your component code (Rendering, Button handlers, etc.)
};
// Handle adding a round // Handle adding a round
const handleAddRound = () => { const handleAddRound = () => {
// Check if the max number of rounds is reached // Check if the max number of rounds is reached
@@ -148,13 +144,12 @@ const ScoreTracker = () => {
> >
X X
</Button> </Button>
<Button <Button
variant="outlined" variant="outlined"
onClick={() => navigate('/')} onClick={() => navigate('/')}
> >
Main Menu Main Menu
</Button> </Button>
</Box> </Box>
</Grid> </Grid>
@@ -185,25 +180,27 @@ const ScoreTracker = () => {
Bullseyes: {state.currentGame.totalBullseyes} Bullseyes: {state.currentGame.totalBullseyes}
</Typography> </Typography>
</Grid> </Grid>
{/* Round history */}
<Grid item xs={12}> {/* Round history */}
<Box sx={{ maxHeight: '200px', overflow: 'auto' }}> <Grid item xs={12}>
{state.currentGame && state.currentGame.rounds && state.currentGame.rounds.length > 0 ? ( <Box sx={{ maxHeight: '200px', overflow: 'auto' }}>
state.currentGame.rounds.map((round, roundIndex) => ( {state.currentGame && state.currentGame.rounds && state.currentGame.rounds.length > 0 ? (
<Typography key={roundIndex} variant="body2" align="center"> state.currentGame.rounds.map((round, roundIndex) => (
Round {roundIndex + 1}: {round.arrows ? round.arrows.join(', ') : 'No arrows'} <Typography key={roundIndex} variant="body2" align="center">
(Total: {round.total || 0}, Bullseyes: {round.bullseyes || 0}) Round {roundIndex + 1}: {round.arrows ? round.arrows.join(', ') : 'No arrows'}
</Typography> (Total: {round.total || 0}, Bullseyes: {round.bullseyes || 0})
)) </Typography>
) : ( ))
<Typography variant="body2" align="center"> ) : (
No rounds played yet. <Typography variant="body2" align="center">
</Typography> No rounds played yet.
)} </Typography>
</Box> )}
</Grid> </Box>
</Grid> </Grid>
</Grid>
); );
}; };
export default ScoreTracker; export default ScoreTracker;