'use client'; import { copy } from '@/shared/i18n'; import { cn } from '@/shared/lib/cn'; import { RECOVERY_30S_MODE_LABEL, Restart30sAction, useRestart30s, } from '@/features/restart-30s'; interface SpaceTimerHudWidgetProps { timeDisplay?: string; className?: string; hasActiveSession?: boolean; sessionPhase?: 'focus' | 'break' | null; playbackState?: 'running' | 'paused' | null; isControlsDisabled?: boolean; isImmersionMode?: boolean; canStart?: boolean; canPause?: boolean; canReset?: boolean; onStartClick?: () => void; onPauseClick?: () => void; onResetClick?: () => void; } const HUD_ACTIONS = copy.space.timerHud.actions; export const SpaceTimerHudWidget = ({ timeDisplay = '25:00', className, hasActiveSession = false, sessionPhase = 'focus', playbackState = 'paused', isControlsDisabled = false, isImmersionMode = false, canStart = true, canPause = false, canReset = false, onStartClick, onPauseClick, onResetClick, }: SpaceTimerHudWidgetProps) => { const { isBreatheMode, triggerRestart } = useRestart30s(); const modeLabel = isBreatheMode ? RECOVERY_30S_MODE_LABEL : !hasActiveSession ? copy.space.timerHud.readyMode : sessionPhase === 'break' ? copy.space.timerHud.breakMode : copy.space.timerHud.focusMode; return (
{modeLabel} {timeDisplay}
{HUD_ACTIONS.map((action) => { const isStartAction = action.id === 'start'; const isPauseAction = action.id === 'pause'; const isResetAction = action.id === 'reset'; const isDisabled = isControlsDisabled || (isStartAction ? !canStart : isPauseAction ? !canPause : !canReset); const isHighlighted = (isStartAction && playbackState !== 'running') || (isPauseAction && playbackState === 'running'); return ( ); })}
); };