fix : lichess api return type

This commit is contained in:
GuillaumeSD
2025-05-10 20:01:01 +02:00
parent 82d216dfb0
commit fea1f3fe47
3 changed files with 9 additions and 7 deletions

View File

@@ -160,7 +160,9 @@ export default function EngineSettingsDialog({ open, onClose }: Props) {
displayEmpty
input={<OutlinedInput label="Piece set" />}
value={pieceSet}
onChange={(e) => setPieceSet(e.target.value)}
onChange={(e) =>
setPieceSet(e.target.value as (typeof PIECE_SETS)[number])
}
sx={{ width: 200, maxWidth: "100%" }}
>
{PIECE_SETS.map((name) => (

View File

@@ -72,7 +72,7 @@ export default function LichessInput({ onSelect }: Props) {
onClick={() => {
setBoardOrientation(
lichessUsername.toLowerCase() !==
game.players.black.user?.name.toLowerCase()
game.players?.black?.user?.name.toLowerCase()
);
onSelect(game.pgn);
}}
@@ -81,10 +81,10 @@ export default function LichessInput({ onSelect }: Props) {
>
<ListItemText
primary={`${
capitalize(game.players.white.user?.name || "white") ||
capitalize(game.players?.white?.user?.name || "white") ||
"White"
} (${game.players?.white?.rating || "?"}) vs ${
capitalize(game.players.black.user?.name || "black") ||
capitalize(game.players?.black?.user?.name || "black") ||
"Black"
} (${game.players?.black?.rating || "?"})`}
secondary={`${capitalize(game.speed)} played at ${new Date(

View File

@@ -21,9 +21,9 @@ export interface LichessGame {
id: string;
speed: string;
lastMoveAt: number;
players: {
white: LichessGameUser;
black: LichessGameUser;
players?: {
white?: LichessGameUser;
black?: LichessGameUser;
};
pgn: string;
}