server for auth, more goodies

This commit is contained in:
polwex 2026-04-19 00:54:39 +07:00
parent f83bce8e2b
commit 7cebe39a14
7 changed files with 80 additions and 24 deletions

View file

@ -89,8 +89,13 @@ function FallingWordsGame({ highScore, onGameOver }: Props) {
const livesRef = useRef(5)
const gameOverRef = useRef(false)
livesRef.current = lives
gameOverRef.current = gameOver
useEffect(() => {
livesRef.current = lives
}, [lives])
useEffect(() => {
gameOverRef.current = gameOver
}, [gameOver])
const spawnWord = useCallback(() => {
const difficulty = difficultyRef.current

View file

@ -811,7 +811,7 @@ export function MissileGame({ highScore, onGameOver }: Props) {
}
}
// Wrong key: do nothing (no penalty for wrong chars, just no progress)
}, [started, gameOver, startGame, triggerShake])
}, [started, gameOver, startGame])
return (
<div className="fade-in">

View file

@ -26,7 +26,10 @@ export function useTypingEngine(
const startTimeRef = useRef<number | null>(null)
const [wpm, setWpm] = useState(0)
const onCompleteRef = useRef(onComplete)
onCompleteRef.current = onComplete
useEffect(() => {
onCompleteRef.current = onComplete
}, [onComplete])
const accuracy = totalKeystrokes > 0 ? Math.round((correctKeystrokes / totalKeystrokes) * 100) : 100