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

@@ -14,9 +14,12 @@ export const useChessActions = (chessAtom: PrimitiveAtom<Chess>) => {
[setGame]
);
const reset = useCallback(() => {
setGame(new Chess());
}, [setGame]);
const reset = useCallback(
(fen?: string) => {
setGame(new Chess(fen));
},
[setGame]
);
const copyGame = useCallback(() => {
const newGame = new Chess();