"use client"; import React from "react"; import { motion } from "motion/react"; import { ScrollArea } from "~/components/ui/scroll-area"; import { cn } from "~/lib/utils"; interface MoveHistoryProps { moves: string[]; currentMoveNumber: number; className?: string; } /** * Move history display component */ const MoveHistory: React.FC = ({ moves, className }) => { const formatMoveHistory = () => { const formatted: Array<{ moveNumber: number; white: string; black?: string; }> = []; for (let i = 0; i < moves.length; i += 2) { formatted.push({ moveNumber: Math.floor(i / 2) + 1, white: moves[i], black: moves[i + 1], }); } return formatted; }; const formattedMoves = formatMoveHistory(); if (moves.length === 0) { return (

No moves yet

); } return (

Move History

{formattedMoves.map((move, index) => (
{move.moveNumber}. {move.white} {move.black || ""}
))}
Total moves: {moves.length}
); }; export { MoveHistory };