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