fix : default load game value

This commit is contained in:
GuillaumeSD
2025-05-15 16:43:57 +02:00
parent 4b841c7d2e
commit c35c1bf0a3

View File

@@ -35,7 +35,7 @@ export default function NewGameDialog({ open, onClose, setGame }: Props) {
const [pgn, setPgn] = useState(""); const [pgn, setPgn] = useState("");
const [gameOrigin, setGameOrigin] = useLocalStorage( const [gameOrigin, setGameOrigin] = useLocalStorage(
"preferred-game-origin", "preferred-game-origin",
GameOrigin.Pgn GameOrigin.ChessCom
); );
const [parsingError, setParsingError] = useState(""); const [parsingError, setParsingError] = useState("");
const setBoardOrientation = useSetAtom(boardOrientationAtom); const setBoardOrientation = useSetAtom(boardOrientationAtom);
@@ -109,9 +109,9 @@ export default function NewGameDialog({ open, onClose, setGame }: Props) {
setParsingError(""); setParsingError("");
}} }}
> >
{Object.values(GameOrigin).map((origin) => ( {Object.entries(gameOriginLabel).map(([origin, label]) => (
<MenuItem key={origin} value={origin}> <MenuItem key={origin} value={origin}>
{gameOriginLabel[origin]} {label}
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>
@@ -160,7 +160,7 @@ export default function NewGameDialog({ open, onClose, setGame }: Props) {
} }
const gameOriginLabel: Record<GameOrigin, string> = { const gameOriginLabel: Record<GameOrigin, string> = {
[GameOrigin.Pgn]: "PGN",
[GameOrigin.ChessCom]: "Chess.com", [GameOrigin.ChessCom]: "Chess.com",
[GameOrigin.Lichess]: "Lichess.org", [GameOrigin.Lichess]: "Lichess.org",
[GameOrigin.Pgn]: "PGN",
}; };