pass current fen and ply to state

This commit is contained in:
2026-06-02 14:44:18 +02:00
parent b8bd48885e
commit 98fbc4d253
3 changed files with 23 additions and 4 deletions
+7 -1
View File
@@ -19,6 +19,12 @@ const PgnViewer = ({ gamePgn, handlePlyChange }: IProps) => {
scrollToMove: false,
});
// set initial position - TODO change onto file load
// handlePlyChange({
// ply: 0,
// fen: viewerRef.current?.curData().fen,
// });
const boardButtons = document.querySelectorAll(".lpv__controls");
const movesList = document.querySelectorAll(".lpv__moves");
if (!boardButtons || !movesList) return;
@@ -71,7 +77,7 @@ const PgnViewer = ({ gamePgn, handlePlyChange }: IProps) => {
move.removeEventListener("touchstart", clickHandlerDelay);
});
};
}, [gamePgn, handlePlyChange]);
}, [gamePgn]);
return <div ref={containerRef} className="lpv-board" />;
};