'use client' import { Pause, Play } from 'lucide-react' import { TimerColorStatus } from '@/lib/companion/types' import { PIE_TIMER_RADIUS, PIE_TIMER_CIRCUMFERENCE, PIE_TIMER_STROKE_WIDTH, PIE_TIMER_SIZE, TIMER_COLOR_CLASSES, TIMER_BG_COLORS, formatTime, } from '@/lib/companion/constants' interface VisualPieTimerProps { progress: number // 0-1 (how much time has elapsed) remainingSeconds: number totalSeconds: number colorStatus: TimerColorStatus isPaused: boolean currentPhaseName: string phaseColor: string onTogglePause?: () => void size?: 'sm' | 'md' | 'lg' } const sizeConfig = { sm: { outer: 120, viewBox: 100, radius: 38, stroke: 6, fontSize: 'text-lg' }, md: { outer: 180, viewBox: 100, radius: 40, stroke: 7, fontSize: 'text-2xl' }, lg: { outer: 240, viewBox: 100, radius: 42, stroke: 8, fontSize: 'text-4xl' }, } export function VisualPieTimer({ progress, remainingSeconds, totalSeconds, colorStatus, isPaused, currentPhaseName, phaseColor, onTogglePause, size = 'lg', }: VisualPieTimerProps) { const config = sizeConfig[size] const circumference = 2 * Math.PI * config.radius // Calculate stroke-dashoffset for progress // Progress goes from 0 (full) to 1 (empty), so offset decreases as time passes const strokeDashoffset = circumference * (1 - progress) // For overtime, show a pulsing full circle const isOvertime = colorStatus === 'overtime' const displayTime = formatTime(remainingSeconds) // Get color classes based on status const colorClasses = TIMER_COLOR_CLASSES[colorStatus] const bgColorClass = TIMER_BG_COLORS[colorStatus] return (
Ueberzogen - Zeit fuer die naechste Phase!
) : colorStatus === 'critical' ? (Weniger als 2 Minuten verbleibend
) : colorStatus === 'warning' ? (Weniger als 5 Minuten verbleibend
) : null}