"use client"; import React, { useState } from "react"; import { Bot, Play, X } from "lucide-react"; import { motion } from "motion/react"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; import { Label } from "~/components/ui/label"; import { Slider } from "~/components/ui/slider"; import { cn } from "~/lib/utils"; interface EngineControlsProps { enabled: boolean; thinking: boolean; evaluation?: number; depth?: number; bestMove?: string; onToggle: () => void; onRequestMove: () => void; onDepthChange?: (depth: number) => void; className?: string; } /** * Stockfish engine controls (placeholder for future integration) */ const EngineControls: React.FC = ({ enabled, thinking, evaluation = 0, depth = 15, bestMove, onToggle, onRequestMove, onDepthChange, className, }) => { const [localDepth, setLocalDepth] = useState(depth); const formatEvaluation = (evaluation: number): string => { if (Math.abs(evaluation) > 100) { return evaluation > 0 ? "M+" : "M-"; } return (evaluation / 100).toFixed(2); }; const getEvaluationColor = (evaluation: number): string => { if (evaluation > 2) return "text-green-600 dark:text-green-400"; if (evaluation > 0.5) return "text-green-500 dark:text-green-500"; if (evaluation < -2) return "text-red-600 dark:text-red-400"; if (evaluation < -0.5) return "text-red-500 dark:text-red-500"; return "text-muted-foreground"; }; const handleDepthChange = (value: number[]) => { setLocalDepth(value[0]); if (onDepthChange) { onDepthChange(value[0]); } }; return (

Engine Analysis

{enabled && (
{/* Evaluation */}
Black {formatEvaluation(evaluation)} White
{/* Depth control */}
{/* Best move */} {bestMove && (
{bestMove}
)} {/* Note */}

Note: Stockfish integration is a placeholder. Implement using stockfish.js or WASM.

)}
); }; export { EngineControls };