update stats on loss, not on reset
This commit is contained in:
parent
61461e6d62
commit
4dd91ad03c
1 changed files with 4 additions and 4 deletions
|
@ -61,10 +61,6 @@ export function Game(props: GameProps) {
|
||||||
setGuesses([...puzzle.history]);
|
setGuesses([...puzzle.history]);
|
||||||
setCurrentGuess("");
|
setCurrentGuess("");
|
||||||
setGameState(GameState.Playing);
|
setGameState(GameState.Playing);
|
||||||
setTodayStats((oldStats) => ({
|
|
||||||
...oldStats,
|
|
||||||
tries: oldStats.tries + 1,
|
|
||||||
}));
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -181,6 +177,10 @@ export function Game(props: GameProps) {
|
||||||
} else if (guesses.length + 1 === puzzle.history.length + MAX_GUESSES) {
|
} else if (guesses.length + 1 === puzzle.history.length + MAX_GUESSES) {
|
||||||
setHint(<p>Not quite! The answer could've been <strong>{game.possible_word().toUpperCase()}</strong>. (Enter to try again)</p>);
|
setHint(<p>Not quite! The answer could've been <strong>{game.possible_word().toUpperCase()}</strong>. (Enter to try again)</p>);
|
||||||
setGameState(GameState.Lost);
|
setGameState(GameState.Lost);
|
||||||
|
setTodayStats((oldStats) => ({
|
||||||
|
...oldStats,
|
||||||
|
tries: oldStats.tries + 1,
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
speak(describeClue(clue(result)));
|
speak(describeClue(clue(result)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue