/** * ChessBoard component — live chess board with piece animations * Design: Quantitative Finance Dark — cream/brown squares, high-contrast pieces * * White pieces: bright white (#FFFFFF) with thick dark stroke — visible on ALL squares * Black pieces: vivid gold (#FFD700) with dark shadow — visible on ALL squares * Layout: fully self-contained, no overflow, stable position */ import { PIECES, type GameState } from "@/lib/simulation"; interface ChessBoardProps { state: GameState; } const LIGHT_SQ = "#F0D9B5"; const DARK_SQ = "#B58863"; const FILES = ["a","b","c","d","e","f","g","h"]; const RANKS = ["8","7","6","5","4","3","2","1"]; export default function ChessBoard({ state }: ChessBoardProps) { return (
{/* Board + rank labels row */}
{/* Rank labels */}
{RANKS.map((r) => ( {r} ))}
{/* Board + file labels column */}
{/* Board grid */}
{state.board.map((row, rankIdx) => row.map((piece, fileIdx) => { const isLight = (rankIdx + fileIdx) % 2 === 0; const isWhitePiece = piece !== null && piece === piece.toUpperCase(); return (
{piece && ( {PIECES[piece] ?? piece} )}
); }) )}
{/* File labels */}
{FILES.map((f) => ( {f} ))}
); }