feat: added web view 1v1
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
export type GameTurn = 'white' | 'black';
|
||||
|
||||
export type GameStatus =
|
||||
| 'started'
|
||||
| 'check'
|
||||
| 'checkmate'
|
||||
| 'stalemate'
|
||||
| 'resign'
|
||||
| 'draw'
|
||||
| 'drawOffered'
|
||||
| 'fiftyMoveAvailable'
|
||||
| 'promotionPending'
|
||||
| 'insufficientMaterial';
|
||||
|
||||
export interface PlayerInfo {
|
||||
id: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export interface GameState {
|
||||
fen: string;
|
||||
pgn: string;
|
||||
turn: GameTurn;
|
||||
status: GameStatus;
|
||||
winner?: GameTurn | null;
|
||||
moves: string[];
|
||||
undoAvailable: boolean;
|
||||
redoAvailable: boolean;
|
||||
}
|
||||
|
||||
export interface GameFull {
|
||||
gameId: string;
|
||||
white: PlayerInfo;
|
||||
black: PlayerInfo;
|
||||
state: GameState;
|
||||
}
|
||||
|
||||
export interface LegalMove {
|
||||
from: string;
|
||||
to: string;
|
||||
uci: string;
|
||||
moveType: string;
|
||||
promotion?: 'queen' | 'rook' | 'bishop' | 'knight' | null;
|
||||
}
|
||||
|
||||
export interface LegalMovesResponse {
|
||||
moves: LegalMove[];
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
code: string;
|
||||
message: string;
|
||||
field?: string | null;
|
||||
}
|
||||
|
||||
export interface GameFullEvent {
|
||||
type: 'gameFull';
|
||||
game: GameFull;
|
||||
}
|
||||
|
||||
export interface GameStateEvent {
|
||||
type: 'gameState';
|
||||
state: GameState;
|
||||
}
|
||||
|
||||
export interface ErrorEvent {
|
||||
type: 'error';
|
||||
error: ApiError;
|
||||
}
|
||||
|
||||
export type GameStreamEvent = GameFullEvent | GameStateEvent | ErrorEvent;
|
||||
Reference in New Issue
Block a user