fix : default load game value
This commit is contained in:
@@ -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",
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user