fix : piece set render

This commit is contained in:
GuillaumeSD
2025-05-11 21:41:40 +02:00
parent 4a44aaf23e
commit 3cb632088a

View File

@@ -1,4 +1,4 @@
import { Grid2 as Grid } from "@mui/material"; import { Box, Grid2 as Grid } from "@mui/material";
import { Chessboard } from "react-chessboard"; import { Chessboard } from "react-chessboard";
import { PrimitiveAtom, atom, useAtomValue, useSetAtom } from "jotai"; import { PrimitiveAtom, atom, useAtomValue, useSetAtom } from "jotai";
import { import {
@@ -19,7 +19,6 @@ import EvaluationBar from "./evaluationBar";
import { CLASSIFICATION_COLORS } from "@/constants"; import { CLASSIFICATION_COLORS } from "@/constants";
import { Player } from "@/types/game"; import { Player } from "@/types/game";
import PlayerHeader from "./playerHeader"; import PlayerHeader from "./playerHeader";
import Image from "next/image";
import { boardHueAtom, pieceSetAtom } from "./states"; import { boardHueAtom, pieceSetAtom } from "./states";
import tinycolor from "tinycolor2"; import tinycolor from "tinycolor2";
@@ -235,15 +234,12 @@ export default function Board({
() => () =>
PIECE_CODES.reduce<CustomPieces>((acc, piece) => { PIECE_CODES.reduce<CustomPieces>((acc, piece) => {
acc[piece] = ({ squareWidth }) => ( acc[piece] = ({ squareWidth }) => (
<Image <Box
src={`/piece/${pieceSet}/${piece}.svg`}
alt={piece}
loading="eager"
width={squareWidth} width={squareWidth}
height={squareWidth} height={squareWidth}
style={{ sx={{
objectFit: "contain", backgroundImage: `url(/piece/${pieceSet}/${piece}.svg)`,
cursor: "grab", backgroundSize: "contain",
}} }}
/> />
); );