diff --git a/src/components/Board/GameBoard.tsx b/src/components/Board/GameBoard.tsx index 9891424e..ea235b6d 100644 --- a/src/components/Board/GameBoard.tsx +++ b/src/components/Board/GameBoard.tsx @@ -141,7 +141,9 @@ export const GameBoard: React.FC = ({ return { fen, lastMove, - check: currentNode.check, + check: currentNode.check + ? (currentNode.turn === 'w' ? 'white' : 'black') + : false, orientation: orientation as 'white' | 'black', } }, [currentNode, game, orientation]) diff --git a/src/components/Board/GameClock.tsx b/src/components/Board/GameClock.tsx index 4eacc17b..6b5d5594 100644 --- a/src/components/Board/GameClock.tsx +++ b/src/components/Board/GameClock.tsx @@ -60,24 +60,47 @@ export const GameClock: React.FC = ( return (
- - {props.player === 'black' ? '●' : '○'}{' '} - {player === props.player - ? user?.displayName - : getMaiaDisplayName(maiaVersion)} + + + + {player === props.player + ? user?.displayName + : getMaiaDisplayName(maiaVersion)} +
-
+
{minutes}:{('00' + seconds).slice(-2)} {showTenths ? '.' + tenths : null}
diff --git a/src/components/Common/MaterialBalance.tsx b/src/components/Common/MaterialBalance.tsx index 6071e2e6..006eec6c 100644 --- a/src/components/Common/MaterialBalance.tsx +++ b/src/components/Common/MaterialBalance.tsx @@ -21,21 +21,21 @@ const STARTING_MATERIAL: { white: MaterialCount; black: MaterialCount } = { black: { p: 8, n: 2, b: 2, r: 2, q: 1, k: 1 }, } -const getPieceIcon = (piece: PieceType): string => { - const iconMap: Record = { - p: 'chess_pawn', - n: 'chess_knight', - b: 'chess_bishop', - r: 'chess_rook', - q: 'chess', - k: 'chess', +const getPieceLabel = (piece: PieceType): string => { + const labelMap: Record = { + p: 'pawn', + n: 'knight', + b: 'bishop', + r: 'rook', + q: 'queen', + k: 'king', } - return iconMap[piece] + return labelMap[piece] } -const getPieceLabel = (piece: PieceType): string => { - const labelMap: Record = { +const getPieceSpriteClass = (piece: PieceType): string => { + const spriteMap: Record = { p: 'pawn', n: 'knight', b: 'bishop', @@ -44,7 +44,7 @@ const getPieceLabel = (piece: PieceType): string => { k: 'king', } - return labelMap[piece] + return spriteMap[piece] } const calculateCapturedPieces = (fen: string) => { @@ -113,12 +113,14 @@ export const MaterialBalance = ({ className = '', iconClassName = '', textClassName = '', + pieceFilter, }: { fen?: string color: Color className?: string iconClassName?: string textClassName?: string + pieceFilter?: string }) => { const materialData = useMemo(() => { if (!fen) { @@ -166,10 +168,12 @@ export const MaterialBalance = ({ return null } - const capturedPieceToneClass = - color === 'white' - ? 'text-zinc-900 [text-shadow:0_0_1px_rgba(255,255,255,0.95)]' - : 'text-white [text-shadow:0_0_1px_rgba(0,0,0,0.9)]' + const capturedPieceColor = color === 'white' ? 'black' : 'white' + const capturedPieceFilter = + pieceFilter ?? + capturedPieceColor === 'black' + ? 'drop-shadow(0 0 0.8px rgba(255,255,255,0.82)) drop-shadow(0 0 1.5px rgba(255,255,255,0.28))' + : 'drop-shadow(0 0 0.8px rgba(0,0,0,0.82)) drop-shadow(0 0 1.5px rgba(0,0,0,0.22))' return (
@@ -186,23 +190,25 @@ export const MaterialBalance = ({ {Array.from({ length: count }).map((_, index) => ( 0 ? '-ml-1.5' : ''} ${iconClassName}`.trim()} + className={`cg-wrap !relative !inline-block !h-[1em] !w-[1em] align-middle ${ + index > 0 ? '-ml-1.5' : '' + } ${iconClassName}`.trim()} title={getPieceLabel(piece)} > - {getPieceIcon(piece)} + ))}
) })}
- {materialData.advantage > 0 && ( - - +{materialData.advantage} - - )}
) } diff --git a/src/pages/analysis/[...id].tsx b/src/pages/analysis/[...id].tsx index d195854a..36c7e9ac 100644 --- a/src/pages/analysis/[...id].tsx +++ b/src/pages/analysis/[...id].tsx @@ -1604,8 +1604,8 @@ const Analysis: React.FC = ({ fen={controller.currentNode?.fen} color="white" className="whitespace-nowrap" - iconClassName="!text-[12px]" - textClassName="text-[11px] text-white/85" + iconClassName="!text-[18px]" + textClassName="text-[14px] text-white/90" /> = ({ fen={controller.currentNode?.fen} color="black" className="whitespace-nowrap" - iconClassName="!text-[12px]" - textClassName="text-[11px] text-white/85" + iconClassName="!text-[18px]" + textClassName="text-[14px] text-white/90" /> @@ -1893,8 +1893,8 @@ const Analysis: React.FC = ({ fen={controller.currentNode?.fen} color="white" className="whitespace-nowrap" - iconClassName="!text-[11px]" - textClassName="text-[10px] text-primary/75" + iconClassName="!text-[13px]" + textClassName="text-[11px] text-primary/80" /> = ({ fen={controller.currentNode?.fen} color="black" className="whitespace-nowrap" - iconClassName="!text-[11px]" - textClassName="text-[10px] text-primary/75" + iconClassName="!text-[13px]" + textClassName="text-[11px] text-primary/80" />