feat : add progress bar

This commit is contained in:
GuillaumeSD
2024-03-08 23:56:29 +01:00
parent 91b56fde60
commit 81cbc2ca80
7 changed files with 72 additions and 27 deletions

View File

@@ -4,6 +4,7 @@ import { useChessActions } from "@/hooks/useChessActions";
import {
boardAtom,
boardOrientationAtom,
evaluationProgressAtom,
gameAtom,
gameEvalAtom,
} from "../states";
@@ -20,6 +21,7 @@ export default function LoadGame() {
const { gameFromUrl } = useGameDatabase();
const setEval = useSetAtom(gameEvalAtom);
const setBoardOrientation = useSetAtom(boardOrientationAtom);
const evaluationProgress = useAtomValue(evaluationProgressAtom);
const resetAndSetGamePgn = useCallback(
(pgn: string) => {
@@ -48,6 +50,8 @@ export default function LoadGame() {
const isGameLoaded = gameFromUrl !== undefined || !!game.header().White;
if (evaluationProgress) return null;
return (
<LoadGameButton
label={isGameLoaded ? "Load another game" : "Load game"}