feat : allow custom starting fen
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -8,6 +8,7 @@ import NextMoveButton from "./nextMoveButton";
|
||||
import GoToLastPositionButton from "./goToLastPositionButton";
|
||||
import SaveButton from "./saveButton";
|
||||
import { useEffect } from "react";
|
||||
import { getStartingFen } from "@/lib/chess";
|
||||
|
||||
export default function ReviewPanelToolBar() {
|
||||
const board = useAtomValue(boardAtom);
|
||||
@@ -38,7 +39,7 @@ export default function ReviewPanelToolBar() {
|
||||
<Tooltip title="Reset board">
|
||||
<Grid>
|
||||
<IconButton
|
||||
onClick={() => resetBoard()}
|
||||
onClick={() => resetBoard(getStartingFen(board.pgn()))}
|
||||
disabled={boardHistory.length === 0}
|
||||
>
|
||||
<Icon icon="ri:skip-back-line" />
|
||||
|
||||
Reference in New Issue
Block a user