feat : allow custom starting fen

This commit is contained in:
GuillaumeSD
2024-03-17 22:13:54 +01:00
parent 72826d03b2
commit d916899731
4 changed files with 18 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ import { useGameDatabase } from "@/hooks/useGameDatabase";
import { useAtomValue, useSetAtom } from "jotai";
import { Chess } from "chess.js";
import { useRouter } from "next/router";
import { getStartingFen } from "@/lib/chess";
export default function LoadGame() {
const router = useRouter();
@@ -25,7 +26,7 @@ export default function LoadGame() {
const resetAndSetGamePgn = useCallback(
(pgn: string) => {
resetBoard();
resetBoard(getStartingFen(pgn));
setEval(undefined);
setBoardOrientation(true);
setGamePgn(pgn);