diff --git a/src/hooks/useScreenSize.ts b/src/hooks/useScreenSize.ts
index 40db713..a392927 100644
--- a/src/hooks/useScreenSize.ts
+++ b/src/hooks/useScreenSize.ts
@@ -24,7 +24,7 @@ export const useScreenSize = () => {
const handleResize = () => {
setScreenSize((prev) => ({
...prev,
- height: window.innerHeight - 120,
+ height: window.innerHeight - 100,
}));
};
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 0fdb308..f728e12 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -81,10 +81,13 @@ export default function GameAnalysis() {
maxWidth: "1200px",
}}
rowGap={2}
- maxHeight={{ lg: "calc(95vh - 80px)", xs: "900px" }}
+ maxHeight={{ lg: "calc(95vh - 60px)", xs: "900px" }}
display="grid"
- gridTemplateRows="repeat(3, auto) fit-content(100%)"
- marginTop={isLgOrGreater && window.innerHeight > 780 ? 4 : 0}
+ gridTemplateRows={
+ gameEval
+ ? "repeat(2, auto) max-content fit-content(100%) fit-content(100%) auto"
+ : "repeat(3, auto) fit-content(100%)"
+ }
size={{
xs: 12,
lg: "grow",
@@ -96,77 +99,91 @@ export default function GameAnalysis() {
)}
+ {isLgOrGreater && }
+
{!isLgOrGreater && !gameEval && }
{!isLgOrGreater && !gameEval && (
)}
-
- setTab(newValue)}
- aria-label="basic tabs example"
- variant="fullWidth"
- sx={{ minHeight: 0 }}
+ {!isLgOrGreater && (
+
- }
- iconPosition="start"
- sx={{
- textTransform: "none",
- minHeight: 15,
- padding: "5px 0em 12px",
- }}
- disableFocusRipple
- />
+ setTab(newValue)}
+ aria-label="basic tabs example"
+ variant="fullWidth"
+ sx={{ minHeight: 0 }}
+ >
+ }
+ iconPosition="start"
+ sx={{
+ textTransform: "none",
+ minHeight: 15,
+ padding: "5px 0em 12px",
+ }}
+ disableFocusRipple
+ />
- }
- iconPosition="start"
- sx={{
- textTransform: "none",
- minHeight: 15,
- display: isGameLoaded ? undefined : "none",
- padding: "5px 0em 12px",
- }}
- disableFocusRipple
- />
+ }
+ iconPosition="start"
+ sx={{
+ textTransform: "none",
+ minHeight: 15,
+ display: isGameLoaded ? undefined : "none",
+ padding: "5px 0em 12px",
+ }}
+ disableFocusRipple
+ />
- }
- iconPosition="start"
- sx={{
- textTransform: "none",
- minHeight: 15,
- display: gameEval ? undefined : "none",
- padding: "5px 0em 12px",
- }}
- disableFocusRipple
- />
-
-
+ }
+ iconPosition="start"
+ sx={{
+ textTransform: "none",
+ minHeight: 15,
+ display: gameEval ? undefined : "none",
+ padding: "5px 0em 12px",
+ }}
+ disableFocusRipple
+ />
+
+
+ )}
-
-
-
-
+
+
+ {isGameLoaded && (
+
+ )}
{isLgOrGreater && (
diff --git a/src/sections/analysis/panelBody/analysisTab/index.tsx b/src/sections/analysis/panelBody/analysisTab/index.tsx
index 20030ec..cf4cdba 100644
--- a/src/sections/analysis/panelBody/analysisTab/index.tsx
+++ b/src/sections/analysis/panelBody/analysisTab/index.tsx
@@ -1,15 +1,9 @@
-import {
- Grid2 as Grid,
- Grid2Props as GridProps,
- List,
- Typography,
-} from "@mui/material";
+import { Grid2 as Grid, Grid2Props as GridProps, List } from "@mui/material";
import { useAtomValue } from "jotai";
import {
boardAtom,
currentPositionAtom,
engineMultiPvAtom,
- gameAtom,
gameEvalAtom,
} from "../../states";
import LineEvaluation from "./lineEvaluation";
@@ -21,19 +15,9 @@ import Opening from "./opening";
export default function AnalysisTab(props: GridProps) {
const linesNumber = useAtomValue(engineMultiPvAtom);
const position = useAtomValue(currentPositionAtom);
- const game = useAtomValue(gameAtom);
const board = useAtomValue(boardAtom);
const gameEval = useAtomValue(gameEvalAtom);
- const boardHistory = board.history();
- const gameHistory = game.history();
-
- const isGameOver =
- boardHistory.length > 0 &&
- (board.isCheckmate() ||
- board.isDraw() ||
- boardHistory.join() === gameHistory.join());
-
const linesSkeleton: LineEval[] = Array.from({ length: linesNumber }).map(
(_, i) => ({ pv: [`${i}`], depth: 0, multiPv: i + 1 })
);
@@ -49,7 +33,7 @@ export default function AnalysisTab(props: GridProps) {
justifyContent="center"
alignItems="start"
height="100%"
- rowGap={1.2}
+ rowGap={0.8}
{...props}
sx={
props.hidden
@@ -77,16 +61,8 @@ export default function AnalysisTab(props: GridProps) {
- {isGameOver && (
-
-
- Game is over
-
-
- )}
-
-
+
{!board.isCheckmate() &&
engineLines.map((line) => (
diff --git a/src/sections/analysis/panelBody/analysisTab/lineEvaluation.tsx b/src/sections/analysis/panelBody/analysisTab/lineEvaluation.tsx
index 6297934..aa7e735 100644
--- a/src/sections/analysis/panelBody/analysisTab/lineEvaluation.tsx
+++ b/src/sections/analysis/panelBody/analysisTab/lineEvaluation.tsx
@@ -50,11 +50,12 @@ export default function LineEvaluation({ line }: Props) {
-
+
{showSkeleton ? (
-
+
) : (
line.pv.map((uci, i) => {
const san = uciToSan(uci);
diff --git a/src/sections/analysis/panelBody/analysisTab/moveInfo.tsx b/src/sections/analysis/panelBody/analysisTab/moveInfo.tsx
index eebd394..82af1ea 100644
--- a/src/sections/analysis/panelBody/analysisTab/moveInfo.tsx
+++ b/src/sections/analysis/panelBody/analysisTab/moveInfo.tsx
@@ -1,6 +1,6 @@
import { Grid2 as Grid, Skeleton, Stack, Typography } from "@mui/material";
import { useAtomValue } from "jotai";
-import { boardAtom, currentPositionAtom } from "../../states";
+import { boardAtom, currentPositionAtom, gameAtom } from "../../states";
import { useMemo } from "react";
import { moveLineUciToSan } from "@/lib/chess";
import { MoveClassification } from "@/types/enums";
@@ -9,6 +9,7 @@ import Image from "next/image";
export default function MoveInfo() {
const position = useAtomValue(currentPositionAtom);
const board = useAtomValue(boardAtom);
+ const game = useAtomValue(gameAtom);
const bestMove = position?.lastEval?.bestMove;
@@ -21,8 +22,17 @@ export default function MoveInfo() {
return moveLineUciToSan(lastPosition)(bestMove);
}, [bestMove, board]);
+ const boardHistory = board.history();
+ const gameHistory = game.history();
+
if (board.history().length === 0) return null;
+ const isGameOver =
+ boardHistory.length > 0 &&
+ (board.isCheckmate() ||
+ board.isDraw() ||
+ boardHistory.join() === gameHistory.join());
+
if (!bestMoveSan) {
return (
)}
+
{bestMoveLabel && (
)}
+
+ {isGameOver && (
+
+ Game is over
+
+ )}
);
}
diff --git a/src/sections/analysis/panelBody/classificationTab/index.tsx b/src/sections/analysis/panelBody/classificationTab/index.tsx
index a2303f8..c08a49e 100644
--- a/src/sections/analysis/panelBody/classificationTab/index.tsx
+++ b/src/sections/analysis/panelBody/classificationTab/index.tsx
@@ -9,7 +9,7 @@ export default function ClassificationTab(props: GridProps) {
justifyContent="center"
alignItems="start"
height="100%"
- maxHeight="18rem"
+ maxHeight={{ xs: "18rem", lg: "none" }}
{...props}
sx={
props.hidden ? { display: "none" } : { overflow: "hidden", ...props.sx }
diff --git a/src/sections/analysis/panelBody/classificationTab/movesClassificationsRecap/index.tsx b/src/sections/analysis/panelBody/classificationTab/movesClassificationsRecap/index.tsx
index 4a91db9..eddb552 100644
--- a/src/sections/analysis/panelBody/classificationTab/movesClassificationsRecap/index.tsx
+++ b/src/sections/analysis/panelBody/classificationTab/movesClassificationsRecap/index.tsx
@@ -16,9 +16,10 @@ export default function MovesClassificationsRecap() {
container
justifyContent="center"
alignItems="center"
- rowGap={1}
+ rowGap={0.7}
sx={{ scrollbarWidth: "thin", overflowY: "auto" }}
- maxHeight="100%"
+ height="100%"
+ maxHeight="22rem"
size={6}
>
diff --git a/src/sections/analysis/panelBody/graphTab/index.tsx b/src/sections/analysis/panelBody/graphTab/index.tsx
index 274e1c8..643bcc4 100644
--- a/src/sections/analysis/panelBody/graphTab/index.tsx
+++ b/src/sections/analysis/panelBody/graphTab/index.tsx
@@ -93,14 +93,14 @@ export default function GraphTab(props: GridProps) {
sx={
props.hidden
? { display: "none" }
- : { marginY: 1, overflow: "hidden", overflowY: "auto", ...props.sx }
+ : { overflow: "hidden", overflowY: "auto", ...props.sx }
}
>
-
+
setDrawerOpen((val) => !val)}
>
diff --git a/src/sections/layout/index.tsx b/src/sections/layout/index.tsx
index d8dd700..b006526 100644
--- a/src/sections/layout/index.tsx
+++ b/src/sections/layout/index.tsx
@@ -36,7 +36,7 @@ export default function Layout({ children }: PropsWithChildren) {
darkMode={isDarkMode}
switchDarkMode={() => setDarkMode((val) => !val)}
/>
- {children}
+ {children}
);
}