fix initial hint

This commit is contained in:
ashastral 2022-03-15 22:27:30 -07:00
parent 6fad706552
commit f7a9c4a4c2

View file

@ -65,11 +65,7 @@ export function Game(props: GameProps) {
3: defaultPuzzleStats(), 3: defaultPuzzleStats(),
4: defaultPuzzleStats(), 4: defaultPuzzleStats(),
}); });
const [hint, setHint] = useState<JSX.Element | string>( const [hint, setHint] = useState<JSX.Element | string>('');
<p>
Try to guarantee a win in <strong>2 guesses</strong>!
</p>
);
const [shareMsg, setShareMsg] = useState(""); const [shareMsg, setShareMsg] = useState("");
const tableRef = useRef<HTMLTableElement>(null); const tableRef = useRef<HTMLTableElement>(null);
const game = useMemo( const game = useMemo(
@ -135,7 +131,11 @@ export function Game(props: GameProps) {
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>);
} else { } else {
setGameState(GameState.Playing); setGameState(GameState.Playing);
setHint(""); if (selectedPuzzle.guesses?.length) {
setHint("");
} else {
setHint(<p>Try to guarantee a win in <strong>2 guesses</strong>!</p>);
}
} }
}, [puzzle, puzzleType, todayStats]); }, [puzzle, puzzleType, todayStats]);