fix : loading game error display

This commit is contained in:
GuillaumeSD
2025-05-17 04:57:47 +02:00
parent e7e4b737e9
commit 0e5939675b
3 changed files with 37 additions and 29 deletions

View File

@@ -9,13 +9,11 @@ import {
ListItemText,
TextField,
} from "@mui/material";
import { useSetAtom } from "jotai";
import { boardOrientationAtom } from "../analysis/states";
import { useDebounce } from "@/hooks/useDebounce";
import { useQuery } from "@tanstack/react-query";
interface Props {
onSelect: (pgn: string) => void;
onSelect: (pgn: string, boardOrientation?: boolean) => void;
}
export default function LichessInput({ onSelect }: Props) {
@@ -24,7 +22,6 @@ export default function LichessInput({ onSelect }: Props) {
""
);
const debouncedUsername = useDebounce(lichessUsername, 500);
const setBoardOrientation = useSetAtom(boardOrientationAtom);
const {
data: games,
@@ -72,11 +69,10 @@ export default function LichessInput({ onSelect }: Props) {
games.map((game) => (
<ListItemButton
onClick={() => {
setBoardOrientation(
const boardOrientation =
lichessUsername.toLowerCase() !==
game.players?.black?.user?.name?.toLowerCase()
);
onSelect(game.pgn);
game.players?.black?.user?.name?.toLowerCase();
onSelect(game.pgn, boardOrientation);
}}
style={{ width: 350, maxWidth: 350 }}
key={game.id}