feat : add move icons to analysis panel

This commit is contained in:
GuillaumeSD
2024-12-29 17:51:52 +01:00
parent 011a1c21bf
commit 6ada244189

View File

@@ -1,9 +1,10 @@
import { Grid2 as Grid, Typography } from "@mui/material"; import { Grid2 as Grid, Stack, Typography } from "@mui/material";
import { useAtomValue } from "jotai"; import { useAtomValue } from "jotai";
import { boardAtom, currentPositionAtom } from "../../states"; import { boardAtom, currentPositionAtom } from "../../states";
import { useMemo } from "react"; import { useMemo } from "react";
import { moveLineUciToSan } from "@/lib/chess"; import { moveLineUciToSan } from "@/lib/chess";
import { MoveClassification } from "@/types/enums"; import { MoveClassification } from "@/types/enums";
import Image from "next/image";
export default function MoveInfo() { export default function MoveInfo() {
const position = useAtomValue(currentPositionAtom); const position = useAtomValue(currentPositionAtom);
@@ -38,14 +39,40 @@ export default function MoveInfo() {
return ( return (
<Grid container columnGap={5} justifyContent="center" size={12}> <Grid container columnGap={5} justifyContent="center" size={12}>
{moveLabel && ( {moveLabel && (
<Typography align="center" fontSize="0.9rem"> <Stack direction="row" alignItems="center" spacing={1}>
{moveLabel} {moveClassification && (
</Typography> <Image
src={`/icons/${moveClassification}.png`}
alt="move-icon"
width={16}
height={16}
style={{
maxWidth: "3.5vw",
maxHeight: "3.5vw",
}}
/>
)}
<Typography align="center" fontSize="0.9rem">
{moveLabel}
</Typography>
</Stack>
)} )}
{bestMoveLabel && ( {bestMoveLabel && (
<Typography align="center" fontSize="0.9rem"> <Stack direction="row" alignItems="center" spacing={1}>
{bestMoveLabel} <Image
</Typography> src={`/icons/best.png`}
alt="move-icon"
width={16}
height={16}
style={{
maxWidth: "3.5vw",
maxHeight: "3.5vw",
}}
/>
<Typography align="center" fontSize="0.9rem">
{bestMoveLabel}
</Typography>
</Stack>
)} )}
</Grid> </Grid>
); );