diff --git a/COPYING.md b/COPYING.md index c05062d..ce4a9a8 100644 --- a/COPYING.md +++ b/COPYING.md @@ -15,7 +15,6 @@ See the LICENSE file for a copy of the _GNU Affero General Public License_. Files | Author(s) | License --- | --- | --- public/piece/horsey | cham, michael1241 | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) -public/piece/mono | Thibault Duplessis and [Colin M.L. Burnett](https://en.wikipedia.org/wiki/User:Cburnett) | [GPLv2+](https://www.gnu.org/licenses/gpl-2.0.txt) public/piece/cburnett | [Colin M.L. Burnett](https://en.wikipedia.org/wiki/User:Cburnett) | [GPLv2+](https://www.gnu.org/licenses/gpl-2.0.txt) public/piece/chessnut | [Alexis Luengas](https://github.com/LexLuengas) | [Apache 2.0](https://github.com/LexLuengas/chessnut-pieces/blob/master/LICENSE.txt) public/piece/letter | [usolando](https://lichess.org/@/usolando) | AGPLv3+ @@ -38,7 +37,6 @@ public/piece/tatiana | sadsnake1 | [CC BY-NC-SA 4.0](https://creativecommons.org public/piece/staunty | sadsnake1 | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) public/piece/dubrovny | sadsnake1 | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) public/piece/anarcandy | [caderek](https://github.com/caderek) | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) -public/piece/disguised | danegraphics | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) public/piece/kiwen-suwi | [neverRare](https://github.com/neverRare) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) public/piece/mpchess | [Maxime Chupin](https://github.com/chupinmaxime) | [GPL3v3+](https://www.gnu.org/licenses/quick-guide-gplv3.en.html) public/piece/cooke | [fejfar](https://github.com/fejfar) | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) diff --git a/public/piece/disguised/b.svg b/public/piece/disguised/b.svg deleted file mode 100644 index c736fe0..0000000 --- a/public/piece/disguised/b.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/disguised/bB.svg b/public/piece/disguised/bB.svg deleted file mode 120000 index 4fe86e9..0000000 --- a/public/piece/disguised/bB.svg +++ /dev/null @@ -1 +0,0 @@ -b.svg \ No newline at end of file diff --git a/public/piece/disguised/bK.svg b/public/piece/disguised/bK.svg deleted file mode 120000 index 4fe86e9..0000000 --- a/public/piece/disguised/bK.svg +++ /dev/null @@ -1 +0,0 @@ -b.svg \ No newline at end of file diff --git a/public/piece/disguised/bN.svg b/public/piece/disguised/bN.svg deleted file mode 120000 index 4fe86e9..0000000 --- a/public/piece/disguised/bN.svg +++ /dev/null @@ -1 +0,0 @@ -b.svg \ No newline at end of file diff --git a/public/piece/disguised/bP.svg b/public/piece/disguised/bP.svg deleted file mode 120000 index 4fe86e9..0000000 --- a/public/piece/disguised/bP.svg +++ /dev/null @@ -1 +0,0 @@ -b.svg \ No newline at end of file diff --git a/public/piece/disguised/bQ.svg b/public/piece/disguised/bQ.svg deleted file mode 120000 index 4fe86e9..0000000 --- a/public/piece/disguised/bQ.svg +++ /dev/null @@ -1 +0,0 @@ -b.svg \ No newline at end of file diff --git a/public/piece/disguised/bR.svg b/public/piece/disguised/bR.svg deleted file mode 120000 index 4fe86e9..0000000 --- a/public/piece/disguised/bR.svg +++ /dev/null @@ -1 +0,0 @@ -b.svg \ No newline at end of file diff --git a/public/piece/disguised/w.svg b/public/piece/disguised/w.svg deleted file mode 100644 index 39a61a9..0000000 --- a/public/piece/disguised/w.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/disguised/wB.svg b/public/piece/disguised/wB.svg deleted file mode 120000 index f0d4d7b..0000000 --- a/public/piece/disguised/wB.svg +++ /dev/null @@ -1 +0,0 @@ -w.svg \ No newline at end of file diff --git a/public/piece/disguised/wK.svg b/public/piece/disguised/wK.svg deleted file mode 120000 index f0d4d7b..0000000 --- a/public/piece/disguised/wK.svg +++ /dev/null @@ -1 +0,0 @@ -w.svg \ No newline at end of file diff --git a/public/piece/disguised/wN.svg b/public/piece/disguised/wN.svg deleted file mode 120000 index f0d4d7b..0000000 --- a/public/piece/disguised/wN.svg +++ /dev/null @@ -1 +0,0 @@ -w.svg \ No newline at end of file diff --git a/public/piece/disguised/wP.svg b/public/piece/disguised/wP.svg deleted file mode 120000 index f0d4d7b..0000000 --- a/public/piece/disguised/wP.svg +++ /dev/null @@ -1 +0,0 @@ -w.svg \ No newline at end of file diff --git a/public/piece/disguised/wQ.svg b/public/piece/disguised/wQ.svg deleted file mode 120000 index f0d4d7b..0000000 --- a/public/piece/disguised/wQ.svg +++ /dev/null @@ -1 +0,0 @@ -w.svg \ No newline at end of file diff --git a/public/piece/disguised/wR.svg b/public/piece/disguised/wR.svg deleted file mode 120000 index f0d4d7b..0000000 --- a/public/piece/disguised/wR.svg +++ /dev/null @@ -1 +0,0 @@ -w.svg \ No newline at end of file diff --git a/public/piece/mono/B.svg b/public/piece/mono/B.svg deleted file mode 100644 index 0abd87f..0000000 --- a/public/piece/mono/B.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/mono/K.svg b/public/piece/mono/K.svg deleted file mode 100644 index dc46ea0..0000000 --- a/public/piece/mono/K.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/mono/N.svg b/public/piece/mono/N.svg deleted file mode 100644 index 6167094..0000000 --- a/public/piece/mono/N.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/mono/P.svg b/public/piece/mono/P.svg deleted file mode 100644 index 16eb478..0000000 --- a/public/piece/mono/P.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/mono/Q.svg b/public/piece/mono/Q.svg deleted file mode 100644 index 6313174..0000000 --- a/public/piece/mono/Q.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/piece/mono/R.svg b/public/piece/mono/R.svg deleted file mode 100644 index d9ab590..0000000 --- a/public/piece/mono/R.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/board/constants.ts b/src/components/board/constants.ts new file mode 100644 index 0000000..f17e0ac --- /dev/null +++ b/src/components/board/constants.ts @@ -0,0 +1,56 @@ +import { Piece } from "react-chessboard/dist/chessboard/types"; + +export const PIECE_CODES = [ + "wP", + "wB", + "wN", + "wR", + "wQ", + "wK", + "bP", + "bB", + "bN", + "bR", + "bQ", + "bK", +] as const satisfies Piece[]; + +export const PIECE_SETS = [ + "alpha", + "anarcandy", + "caliente", + "california", + "cardinal", + "cburnett", + "celtic", + "chess7", + "chessnut", + "companion", + "cooke", + "dubrovny", + "fantasy", + "firi", + "fresca", + "gioco", + "governor", + "horsey", + "icpieces", + "kiwen-suwi", + "kosal", + "leipzig", + "letter", + "maestro", + "merida", + "monarchy", + "mpchess", + "pirouetti", + "pixel", + "reillycraig", + "rhosgfx", + "riohacha", + "shapes", + "spatial", + "staunty", + "tatiana", + "xkcd", +] as const satisfies string[]; diff --git a/src/components/board/index.tsx b/src/components/board/index.tsx index 75ef9ea..386613b 100644 --- a/src/components/board/index.tsx +++ b/src/components/board/index.tsx @@ -5,7 +5,6 @@ import { Arrow, CustomPieces, CustomSquareRenderer, - Piece, PromotionPieceOption, Square, } from "react-chessboard/dist/chessboard/types"; @@ -22,6 +21,7 @@ import PlayerHeader from "./playerHeader"; import Image from "next/image"; import { boardHueAtom, pieceSetAtom } from "./states"; import tinycolor from "tinycolor2"; +import { PIECE_CODES } from "./constants"; export interface Props { id: string; @@ -233,7 +233,7 @@ export default function Board({ const customPieces = useMemo( () => - pieceCodes.reduce((acc, piece) => { + PIECE_CODES.reduce((acc, piece) => { acc[piece] = ({ squareWidth }) => ( ); } - -const pieceCodes = [ - "wP", - "wB", - "wN", - "wR", - "wQ", - "wK", - "bP", - "bB", - "bN", - "bR", - "bQ", - "bK", -] as const satisfies Piece[]; diff --git a/src/components/board/states.ts b/src/components/board/states.ts index beb9fc0..4ffce8e 100644 --- a/src/components/board/states.ts +++ b/src/components/board/states.ts @@ -1,4 +1,8 @@ import { atomWithStorage } from "jotai/utils"; +import { PIECE_SETS } from "./constants"; -export const pieceSetAtom = atomWithStorage("pieceSet", "cburnett"); +export const pieceSetAtom = atomWithStorage<(typeof PIECE_SETS)[number]>( + "pieceSet", + "maestro" +); export const boardHueAtom = atomWithStorage("boardHue", 0); diff --git a/src/components/slider.tsx b/src/components/slider.tsx index a32188d..d26d9db 100644 --- a/src/components/slider.tsx +++ b/src/components/slider.tsx @@ -1,4 +1,9 @@ -import { Grid2 as Grid, Slider as MuiSlider, Typography } from "@mui/material"; +import { + Grid2 as Grid, + Slider as MuiSlider, + styled, + Typography, +} from "@mui/material"; export interface Props { value: number; @@ -28,11 +33,16 @@ export default function Slider({ alignItems="center" size={size ?? 11} > - + {step === 1 && marksFilter ? label : `${label}: ${value}`} - ); } + +const CustomSlider = styled(MuiSlider)(() => ({ + ".MuiSlider-markLabel": { + fontSize: "0.8rem", + lineHeight: "0.8rem", + }, + ".MuiSlider-thumb": { + width: "18px", + height: "18px", + }, + marginBottom: "1rem", +})); diff --git a/src/sections/engineSettings/engineSettingsDialog.tsx b/src/sections/engineSettings/engineSettingsDialog.tsx index ce9dbf9..e67910e 100644 --- a/src/sections/engineSettings/engineSettingsDialog.tsx +++ b/src/sections/engineSettings/engineSettingsDialog.tsx @@ -24,6 +24,9 @@ import { useAtomLocalStorage } from "@/hooks/useAtomLocalStorage"; import { useEffect } from "react"; import { isEngineSupported } from "@/lib/engine/shared"; import { Stockfish16_1 } from "@/lib/engine/stockfish16_1"; +import { useAtom } from "jotai"; +import { boardHueAtom, pieceSetAtom } from "@/components/board/states"; +import { PIECE_SETS } from "@/components/board/constants"; interface Props { open: boolean; @@ -43,6 +46,8 @@ export default function EngineSettingsDialog({ open, onClose }: Props) { "engine-name", engineNameAtom ); + const [boardHue, setBoardHue] = useAtom(boardHueAtom); + const [pieceSet, setPieceSet] = useAtom(pieceSetAtom); useEffect(() => { if (!isEngineSupported(engineName)) { @@ -56,25 +61,33 @@ export default function EngineSettingsDialog({ open, onClose }: Props) { return ( - - Set engine parameters - + Settings - - Stockfish 17 Lite is the default engine if your device support its - requirements. It offers the best balance between speed and strength. - Stockfish 17 is the strongest engine available, note that it requires - a one time download of 75MB. - - + + + Stockfish 17 Lite is the default engine if your device support its + requirements. It offers the best balance between speed and + strength. Stockfish 17 is the strongest engine available, note + that it requires a one time download of 75MB. + + + + Engine } + value={pieceSet} + onChange={(e) => setPieceSet(e.target.value)} + sx={{ width: 200, maxWidth: "100%" }} + > + {PIECE_SETS.map((name) => ( + + {name} + + ))} + + + - +