'use client';
import { useTimerStore } from '@/lib/store';
import { getRemainingMs } from '@/lib/timer-engine';
import type { Timer } from '@/lib/timer-engine';
import { getUrgencyConfig } from '@/lib/urgency';
import { formatDuration, formatTime, formatDurationCompact } from '@/lib/format';
import { formatMinutesBefore } from '@/lib/cascade';
import {
Clock,
Pause,
Play,
X,
AlarmClock,
Timer as TimerIcon,
Coffee,
Bell,
BellOff,
Repeat,
Link2,
Tag,
} from 'lucide-react';
import { getTimeReferenceMs } from '@/lib/time-blindness';
import { getSuggestedPrepTime, shouldShowPrepWarning, formatPrepWarning } from '@/lib/prep-time';
interface TimerCardProps {
timer: Timer;
}
export function TimerCard({ timer }: TimerCardProps) {
const now = useTimerStore((s) => s.now);
const { pause, resume, dismiss, snooze, advancePom } = useTimerStore();
const urgencyConfig = getUrgencyConfig(timer.urgency);
const remaining = getRemainingMs(timer, now);
const typeIcon = {
alarm:
{getTimeReferenceMs(remaining)}
)}
💬 {timer.customMessage}
)} {!isDone && !isFiring && !timer.customMessage && (() => { const prepConfig = getSuggestedPrepTime(timer.label, timer.category); const minutesUntil = Math.round(remaining / 60_000); if (shouldShowPrepWarning(timer.targetTime, prepConfig, now)) { return (⏱ {formatPrepWarning(prepConfig, minutesUntil)}
); } return null; })()} {/* Snooze info */} {timer.snoozeCount > 0 && (