move game state and head interfaces into shared file

This commit is contained in:
2026-06-02 20:19:47 +02:00
parent 1d6a9f8e6e
commit 7d8f390a50
3 changed files with 26 additions and 26 deletions
+24
View File
@@ -2,3 +2,27 @@ export interface IPosition {
ply: number;
fen: string;
}
export interface IHeader {
event: string;
site: string;
date: string;
round: string;
white: string;
black: string;
result: string;
eco: string;
whiteElo: string;
blackElo: string;
plyCount: string;
eventDate: string;
source: string;
[key: string]: string;
}
export interface IGameState {
pgn: string;
headers: IHeader;
diagrams: IPosition[];
diagramClock: boolean;
}
+1 -25
View File
@@ -1,28 +1,4 @@
import type { IPosition } from "#/interfaces.ts";
export interface IHeader {
event: string;
site: string;
date: string;
round: string;
white: string;
black: string;
result: string;
eco: string;
whiteElo: string;
blackElo: string;
plyCount: string;
eventDate: string;
source: string;
[key: string]: string;
}
export interface IGameState {
pgn: string;
headers: IHeader;
diagrams: IPosition[];
diagramClock: boolean;
}
import type { IGameState, IHeader, IPosition } from "#/interfaces.ts";
type GameAction =
| { type: "SET_GAME"; payload: { pgn: string; headers: IHeader } }
+1 -1
View File
@@ -1,4 +1,4 @@
import type { IGameState } from "#/reducers/gameReducer.ts";
import type { IGameState } from "#/interfaces.ts";
export const getHeaders = (pgn: string) => {
const pgnHeader = pgn.split(/\n\n/g)[0];