'use client' import { useAppStore } from '@/store' import { useConvolution } from '@/hooks/useConvolution' import { Button, Slider, Card, CardContent } from '@/components/ui' import { cn } from '@/utils/helpers' import { Play, Pause, RotateCcw, StepForward, ZoomIn, ZoomOut, Maximize } from 'lucide-react' export function PlaybackControls() { const { convolution, settings, startConvolution, pauseConvolution, resumeConvolution, stopConvolution, updateConvolutionStep, updateConvolutionProgress, completeConvolution, setConvolutionError, resetConvolution, setAnimationSpeed, setZoomLevel, setPanOffset, toggleOverlay, setPadding, setComparisonMode, setStepMode, } = useAppStore() const { runConvolution, pause, resume, stop, step, reset, isRunning, isPaused, canRun, toggleStepMode } = useConvolution() const { status, progress, elapsedTime } = convolution const { animationSpeed, zoomLevel, stepMode } = settings const isCompleted = status === 'completed' const isActive = isRunning || isPaused || isCompleted const formatTime = (ms: number) => { if (ms < 1000) return `${ms}ms` return `${(ms / 1000).toFixed(1)}s` } return ( {/* Main Controls */}
{/* Speed Control */}
`${v.toFixed(1)}x`} />
{/* Zoom Controls */}
`${Math.round(v * 100)}%`} />
{/* Progress */} {isActive && (
Progress {Math.round(progress * 100)}%
Elapsed: {formatTime(elapsedTime)} {status === 'running' ? 'Running' : status === 'paused' ? 'Paused' : 'Completed'}
)} {/* Step Mode Toggle */}
) }