import { Icon } from "@iconify/react"; import { Grid, List, Typography } from "@mui/material"; import { useAtomValue } from "jotai"; import { boardAtom, engineMultiPvAtom, gameAtom } from "../states"; import LineEvaluation from "./lineEvaluation"; import { useCurrentMove } from "@/hooks/useCurrentMove"; import { LineEval } from "@/types/eval"; import { EngineName } from "@/types/enums"; import EngineSettingsButton from "@/sections/engineSettings/engineSettingsButton"; export default function ReviewPanelBody() { const linesNumber = useAtomValue(engineMultiPvAtom); const move = useCurrentMove(EngineName.Stockfish16); const game = useAtomValue(gameAtom); const board = useAtomValue(boardAtom); const boardHistory = board.history(); const gameHistory = game.history(); const bestMove = move?.lastEval?.bestMove; const isGameOver = gameHistory.length > 0 && boardHistory.join() === gameHistory.join(); const linesSkeleton: LineEval[] = Array.from({ length: linesNumber }).map( (_, i) => ({ pv: [`${i}`], depth: 0, multiPv: i + 1 }) ); const engineLines = move?.eval?.lines?.length ? move.eval.lines : linesSkeleton; return ( Engine evaluation {!!bestMove && ( {`${bestMove} was the best move`} )} {isGameOver && ( Game is over )} {engineLines.map((line) => ( ))} ); }