import { Button, CircularProgress, Grid2 as Grid, Typography, } from "@mui/material"; import { useAtom, useAtomValue } from "jotai"; import { gameAtom, isGameInProgressAtom } from "./states"; import { useEffect } from "react"; import { playGameEndSound } from "@/lib/sounds"; import UndoMoveButton from "./undoMoveButton"; export default function GameInProgress() { const game = useAtomValue(gameAtom); const [isGameInProgress, setIsGameInProgress] = useAtom(isGameInProgressAtom); useEffect(() => { if (game.isGameOver()) setIsGameInProgress(false); }, [game, setIsGameInProgress]); const handleResign = () => { playGameEndSound(); setIsGameInProgress(false); }; if (!isGameInProgress) return null; return ( Game in progress ); }