use shared IPosition interface for diagrams and current move state

This commit is contained in:
2026-06-02 20:17:48 +02:00
parent 87fa6997ee
commit 1d6a9f8e6e
4 changed files with 12 additions and 14 deletions
+2 -6
View File
@@ -1,14 +1,10 @@
import { type ChangeEvent, useReducer, useRef, useState } from "react";
import type { IPosition } from "#/interfaces.ts";
import { gameReducer, initialGameState } from "#/reducers/gameReducer.ts";
import { downloadPDF } from "#/utils/pdfUtils.ts";
import { buildPgnString, getHeaders } from "#/utils/pgnUtils.ts";
import { downloadString } from "#/utils/stringUtils.ts";
interface IPosition {
ply: number;
fen: string;
}
export const useChessGame = () => {
const [gameState, gameDispatch] = useReducer(gameReducer, initialGameState);
@@ -21,7 +17,7 @@ export const useChessGame = () => {
const fileInputRef = useRef<HTMLInputElement | null>(null);
const handlePlyChange = ({ ply, fen }: { ply: number; fen: string }) => {
const handlePlyChange = ({ ply, fen }: IPosition) => {
setCurrentPosition({ ply, fen });
};