diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 2da0929..ab1482f 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,6 +1,5 @@ import { useChessActions } from "@/hooks/useChessActions"; import Board from "@/sections/analysis/board"; -import MovesClassificationsRecap from "@/sections/analysis/reviewPanelBody/movesClassificationsRecap"; import ReviewPanelBody from "@/sections/analysis/reviewPanelBody"; import ReviewPanelHeader from "@/sections/analysis/reviewPanelHeader"; import ReviewPanelToolBar from "@/sections/analysis/reviewPanelToolbar"; @@ -15,7 +14,7 @@ import { Chess } from "chess.js"; import { useSetAtom } from "jotai"; import { useRouter } from "next/router"; import { useEffect } from "react"; -import MovesPanel from "@/sections/analysis/reviewPanelBody/movesPanel"; +import ClassificationPanel from "@/sections/analysis/reviewPanelBody/classificationPanel"; export default function GameReport() { const theme = useTheme(); @@ -73,21 +72,7 @@ export default function GameReport() { - - - - - - - + diff --git a/src/sections/analysis/reviewPanelBody/classificationPanel/index.tsx b/src/sections/analysis/reviewPanelBody/classificationPanel/index.tsx new file mode 100644 index 0000000..a9611e1 --- /dev/null +++ b/src/sections/analysis/reviewPanelBody/classificationPanel/index.tsx @@ -0,0 +1,31 @@ +import { Divider, Grid } from "@mui/material"; +import MovesPanel from "./movesPanel"; +import MovesClassificationsRecap from "./movesClassificationsRecap"; +import { useAtomValue } from "jotai"; +import { gameAtom } from "../../states"; + +export default function ClassificationPanel() { + const game = useAtomValue(gameAtom); + + if (!game.history().length) return null; + + return ( + <> + + + + + + + + + ); +} diff --git a/src/sections/analysis/reviewPanelBody/movesClassificationsRecap/classificationRow.tsx b/src/sections/analysis/reviewPanelBody/classificationPanel/movesClassificationsRecap/classificationRow.tsx similarity index 98% rename from src/sections/analysis/reviewPanelBody/movesClassificationsRecap/classificationRow.tsx rename to src/sections/analysis/reviewPanelBody/classificationPanel/movesClassificationsRecap/classificationRow.tsx index 389eeb5..b63cf8b 100644 --- a/src/sections/analysis/reviewPanelBody/movesClassificationsRecap/classificationRow.tsx +++ b/src/sections/analysis/reviewPanelBody/classificationPanel/movesClassificationsRecap/classificationRow.tsx @@ -1,7 +1,7 @@ import { Color, MoveClassification } from "@/types/enums"; import { Grid, Typography } from "@mui/material"; import { useAtomValue } from "jotai"; -import { boardAtom, gameAtom, gameEvalAtom } from "../../states"; +import { boardAtom, gameAtom, gameEvalAtom } from "../../../states"; import { useMemo } from "react"; import { moveClassificationColors } from "@/components/board/squareRenderer"; import Image from "next/image"; diff --git a/src/sections/analysis/reviewPanelBody/movesClassificationsRecap/index.tsx b/src/sections/analysis/reviewPanelBody/classificationPanel/movesClassificationsRecap/index.tsx similarity index 96% rename from src/sections/analysis/reviewPanelBody/movesClassificationsRecap/index.tsx rename to src/sections/analysis/reviewPanelBody/classificationPanel/movesClassificationsRecap/index.tsx index 8ee36eb..9b75130 100644 --- a/src/sections/analysis/reviewPanelBody/movesClassificationsRecap/index.tsx +++ b/src/sections/analysis/reviewPanelBody/classificationPanel/movesClassificationsRecap/index.tsx @@ -1,6 +1,6 @@ import { usePlayersNames } from "@/hooks/usePlayerNames"; import { Grid, Typography } from "@mui/material"; -import { gameAtom, gameEvalAtom } from "../../states"; +import { gameAtom, gameEvalAtom } from "../../../states"; import { MoveClassification } from "@/types/enums"; import ClassificationRow from "./classificationRow"; import { useAtomValue } from "jotai"; diff --git a/src/sections/analysis/reviewPanelBody/movesPanel/index.tsx b/src/sections/analysis/reviewPanelBody/classificationPanel/movesPanel/index.tsx similarity index 94% rename from src/sections/analysis/reviewPanelBody/movesPanel/index.tsx rename to src/sections/analysis/reviewPanelBody/classificationPanel/movesPanel/index.tsx index 8ddc34f..1c2db7f 100644 --- a/src/sections/analysis/reviewPanelBody/movesPanel/index.tsx +++ b/src/sections/analysis/reviewPanelBody/classificationPanel/movesPanel/index.tsx @@ -2,7 +2,7 @@ import { Grid } from "@mui/material"; import MovesLine from "./movesLine"; import { useMemo } from "react"; import { useAtomValue } from "jotai"; -import { gameAtom, gameEvalAtom } from "../../states"; +import { gameAtom, gameEvalAtom } from "../../../states"; import { MoveClassification } from "@/types/enums"; export default function MovesPanel() { @@ -37,8 +37,6 @@ export default function MovesPanel() { return moves; }, [game, gameEval]); - if (!gameMoves) return null; - return (