feat : add lichess user games import

This commit is contained in:
GuillaumeSD
2024-03-17 18:57:22 +01:00
parent f9cb5acc1f
commit 46198f2a47
7 changed files with 147 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import { useState } from "react";
import GamePgnInput from "./gamePgnInput";
import ChessComInput from "./chessComInput";
import { useLocalStorage } from "@/hooks/useLocalStorage";
import LichessInput from "./lichessInput";
interface Props {
open: boolean;
@@ -105,6 +106,10 @@ export default function NewGameDialog({ open, onClose, setGame }: Props) {
<ChessComInput pgn={pgn} setPgn={setPgn} />
)}
{gameOrigin === GameOrigin.Lichess && (
<LichessInput pgn={pgn} setPgn={setPgn} />
)}
{parsingError && (
<FormControl fullWidth>
<Typography color="red" textAlign="center" marginTop={1}>
@@ -133,4 +138,5 @@ export default function NewGameDialog({ open, onClose, setGame }: Props) {
const gameOriginLabel: Record<GameOrigin, string> = {
[GameOrigin.Pgn]: "PGN",
[GameOrigin.ChessCom]: "Chess.com",
[GameOrigin.Lichess]: "Lichess.org",
};