Skip to content

Commit f9a1284

Browse files
committed
Set neon defaults and streamline animation/theme options
1 parent 685fd53 commit f9a1284

9 files changed

Lines changed: 40 additions & 77 deletions

File tree

src/GameContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ export function GameProvider({ children }: { children: ReactNode }) {
257257
const speed = store.settings.animationSpeed;
258258
const minThinkMs =
259259
speed === "very-slow"
260-
? 1900
260+
? 950
261261
: speed === "slow"
262-
? 1200
263-
: 800;
262+
? 600
263+
: 400;
264264
const t0 = performance.now();
265265
const move = await chooseBotMove(state, lvl, { allowExternal: mode.kind === "bot" });
266266
const elapsed = performance.now() - t0;

src/components/Board.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ function isLegalTarget(legal: Move[], sq: Square): Move | undefined {
1010

1111
function slideDurationMs(speed: "normal" | "slow" | "very-slow", isMobile: boolean): number {
1212
if (isMobile) {
13-
if (speed === "very-slow") return 1700;
14-
if (speed === "slow") return 1100;
15-
return 700;
13+
if (speed === "very-slow") return 850;
14+
if (speed === "slow") return 550;
15+
return 350;
1616
}
17-
if (speed === "very-slow") return 1300;
18-
if (speed === "slow") return 800;
19-
return 500;
17+
if (speed === "very-slow") return 650;
18+
if (speed === "slow") return 400;
19+
return 250;
2020
}
2121

2222
interface Props {

src/components/LookPicker.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import type { BoardTheme, PieceSet } from "../engine/storage";
22
import { useGame } from "../GameContext";
33

44
const THEMES: BoardTheme[] = ["wood", "blue", "green", "neon"];
5-
const SETS: PieceSet[] = ["classic", "modern", "neon", "emoji"];
5+
const SETS: PieceSet[] = ["classic", "modern", "neon"];
66

77
const THEME_LABEL: Record<BoardTheme, string> = {
88
wood: "🪵", blue: "🟦", green: "🟩", neon: "✨"
99
};
1010
const SET_LABEL: Record<PieceSet, string> = {
11-
classic: "♚", modern: "♟︎", neon: "💎", emoji: "🐉"
11+
classic: "♚", modern: "♟︎", neon: "💎"
1212
};
1313

1414
export function LookPicker() {

src/components/MinecraftPieces.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/components/Piece.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Color, PieceType } from "../engine/board";
22
import type { PieceSet } from "../engine/storage";
33
import { PieceSVG } from "./PieceSVG";
4-
import { MinecraftPiece } from "./MinecraftPieces";
54

65
const GLYPH: Record<string, string> = {
76
wK: "\u2654", wQ: "\u2655", wR: "\u2656", wB: "\u2657", wN: "\u2658", wP: "\u2659",
@@ -24,13 +23,6 @@ export function Piece({ color, type, set, rotate = false }: Props) {
2423
</span>
2524
);
2625
}
27-
if (set === "emoji") {
28-
return (
29-
<span className={`piece-mc piece-${color} ${faceClass}`}>
30-
<MinecraftPiece color={color} type={type} />
31-
</span>
32-
);
33-
}
3426
// modern + neon both use SVG; neon gets a filter via CSS on the parent.
3527
return (
3628
<span className={`piece-svg piece-${color} ${faceClass}`}>

src/engine/storage.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface ProfileStats {
2424
}
2525

2626
export type BoardTheme = "wood" | "blue" | "green" | "neon";
27-
export type PieceSet = "classic" | "modern" | "neon" | "emoji";
27+
export type PieceSet = "classic" | "modern" | "neon";
2828
export type AnimationSpeed = "normal" | "slow" | "very-slow";
2929

3030
export interface Settings {
@@ -61,15 +61,20 @@ const DEFAULT_SETTINGS: Settings = {
6161
timerSeconds: 30,
6262
animationSpeed: "slow",
6363
rotateBlackPiecesFixedBoard: false,
64-
theme: "wood",
65-
pieceSet: "modern",
64+
theme: "neon",
65+
pieceSet: "neon",
6666
sound: true,
6767
haptics: true,
6868
autoFlip: true,
6969
showThreats: false,
7070
explodeOnCapture: false
7171
};
7272

73+
function normalizePieceSet(value: unknown): PieceSet {
74+
if (value === "classic" || value === "modern" || value === "neon") return value;
75+
return "neon";
76+
}
77+
7378
function emptyStats(): ProfileStats {
7479
return {
7580
wins: 0, losses: 0, draws: 0, rating: 800,
@@ -83,7 +88,12 @@ export function load(): Store {
8388
const raw = localStorage.getItem(KEY);
8489
if (!raw) return { profiles: [], settings: { ...DEFAULT_SETTINGS }, savedGames: {} };
8590
const parsed = JSON.parse(raw) as Store;
86-
parsed.settings = { ...DEFAULT_SETTINGS, ...parsed.settings };
91+
const rawSettings = parsed.settings as Partial<Settings> | undefined;
92+
parsed.settings = {
93+
...DEFAULT_SETTINGS,
94+
...rawSettings,
95+
pieceSet: normalizePieceSet(rawSettings?.pieceSet)
96+
};
8797
parsed.savedGames = parsed.savedGames ?? {};
8898
return parsed;
8999
} catch {

src/screens/GameScreen.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import { useGame } from "../GameContext";
1010

1111
function slideDurationMs(speed: "normal" | "slow" | "very-slow", isMobile: boolean): number {
1212
if (isMobile) {
13-
if (speed === "very-slow") return 1700;
14-
if (speed === "slow") return 1100;
15-
return 700;
13+
if (speed === "very-slow") return 850;
14+
if (speed === "slow") return 550;
15+
return 350;
1616
}
17-
if (speed === "very-slow") return 1300;
18-
if (speed === "slow") return 800;
19-
return 500;
17+
if (speed === "very-slow") return 650;
18+
if (speed === "slow") return 400;
19+
return 250;
2020
}
2121

2222
export function GameScreen() {

src/screens/SettingsScreen.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ export function SettingsScreen() {
5959
{([
6060
{ key: "classic" as const, label: "Classic" },
6161
{ key: "modern" as const, label: "Modern" },
62-
{ key: "neon" as const, label: "Neon" },
63-
{ key: "emoji" as const, label: "Minecraft" }
62+
{ key: "neon" as const, label: "Neon" }
6463
]).map((t) => (
6564
<button key={t.key}
6665
className={t.key === s.pieceSet ? "pill active" : "pill"}
6766
onClick={() => updateSetting("pieceSet", t.key)}>{t.label}</button>
6867
))}
6968
</div>
70-
<p className="hint">Classic = Unicode ♚ · Modern = crisp SVG · Neon = glow · Minecraft = ⛏️ Steve, Alex, Creeper, Enderman, Skeleton, Zombie (light/dark plates for each side)</p>
69+
<p className="hint">Classic = Unicode ♚ · Modern = crisp SVG · Neon = glow</p>
7170
</section>
7271

7372
<section>

src/styles.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@
1010
--legal-capture: rgba(239, 68, 68, 0.65);
1111
--selected: rgba(250, 204, 21, 0.55);
1212
--last: rgba(250, 204, 21, 0.25);
13-
--anim-slide-ms: 500ms;
13+
--anim-slide-ms: 250ms;
1414
--anim-demat-ms: 1300ms;
1515
--anim-remat-ms: 1300ms;
1616
--anim-remat-delay-ms: 1700ms;
1717
}
1818

1919
.board.anim-speed-normal {
20-
--anim-slide-ms: 500ms;
20+
--anim-slide-ms: 250ms;
2121
--anim-demat-ms: 1300ms;
2222
--anim-remat-ms: 1300ms;
2323
--anim-remat-delay-ms: 1700ms;
2424
}
2525

2626
.board.anim-speed-slow {
27-
--anim-slide-ms: 800ms;
27+
--anim-slide-ms: 400ms;
2828
--anim-demat-ms: 1700ms;
2929
--anim-remat-ms: 1700ms;
3030
--anim-remat-delay-ms: 2200ms;
3131
}
3232

3333
.board.anim-speed-very-slow {
34-
--anim-slide-ms: 1300ms;
34+
--anim-slide-ms: 650ms;
3535
--anim-demat-ms: 2300ms;
3636
--anim-remat-ms: 2300ms;
3737
--anim-remat-delay-ms: 3000ms;
3838
}
3939

4040
@media (max-width: 640px) {
4141
.board.anim-speed-normal {
42-
--anim-slide-ms: 700ms;
42+
--anim-slide-ms: 350ms;
4343
--anim-demat-ms: 1500ms;
4444
--anim-remat-ms: 1500ms;
4545
--anim-remat-delay-ms: 2000ms;
4646
}
4747

4848
.board.anim-speed-slow {
49-
--anim-slide-ms: 1100ms;
49+
--anim-slide-ms: 550ms;
5050
--anim-demat-ms: 2000ms;
5151
--anim-remat-ms: 2000ms;
5252
--anim-remat-delay-ms: 2600ms;
5353
}
5454

5555
.board.anim-speed-very-slow {
56-
--anim-slide-ms: 1700ms;
56+
--anim-slide-ms: 850ms;
5757
--anim-demat-ms: 2600ms;
5858
--anim-remat-ms: 2600ms;
5959
--anim-remat-delay-ms: 3400ms;

0 commit comments

Comments
 (0)