import Button from "./Button"; import { THEME } from "../constants"; interface WebcamCaptureProps { isRunning: boolean; onToggleRunning: () => void; error?: string | null; imageSize?: number; onImageSizeChange?: (size: number) => void; } export default function WebcamCapture({ isRunning, onToggleRunning, error, imageSize, onImageSizeChange, }: WebcamCaptureProps) { const hasError = Boolean(error); const statusConfig = hasError ? { text: "SIGNAL LOSS", color: "bg-[var(--mistral-red)]", border: "border-[var(--mistral-red)]", } : isRunning ? { text: "LIVE FEED", color: "bg-[var(--mistral-orange)] animate-pulse", border: "border-[var(--mistral-orange)]", } : { text: "PAUSED", color: "bg-[var(--mistral-orange-dark)]", border: "border-[var(--mistral-beige-dark)]", }; return ( <> {/* Controls Layer */}
{/* Top Bar */}
{/* Status Indicator */}
{isRunning && !hasError && ( )}
{statusConfig.text}
{/* Controls */}
{/* Resolution Slider */} {imageSize && onImageSizeChange && (
Input Size: {imageSize}px onImageSizeChange(Number(e.target.value))} className="w-24 h-1 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-[var(--mistral-orange)]" />
{/* Tooltip */}

<{" "} Lower = Faster (Less accurate)

>{" "} Higher = Slower (More accurate)

)}
); }