All files / src/components QuickTimerButtons.tsx

100% Statements 3/3
100% Branches 5/5
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                                            20x     60x   3x                                
import { Plus, Sparkles, Loader2 } from 'lucide-react'
 
interface QuickTimer {
  label: string
  duration: number
}
 
interface QuickTimerButtonsProps {
  quickTimers: QuickTimer[]
  loadingTimerId: string | null
  aiAvailable: boolean
  instructionText?: string
  onAdd: (label: string, duration: number, index: number) => void
}
 
export default function QuickTimerButtons({
  quickTimers,
  loadingTimerId,
  aiAvailable,
  instructionText,
  onAdd,
}: QuickTimerButtonsProps) {
  return (
    <div className="flex flex-wrap gap-2">
      {quickTimers.map(({ label, duration }, idx) => (
        <button
          key={label}
          onClick={() => onAdd(label, duration, idx)}
          disabled={loadingTimerId !== null}
          className="flex items-center gap-1.5 rounded-full border border-border bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted active:bg-muted/70 disabled:opacity-50"
        >
          {loadingTimerId === `quick-${idx}` ? (
            <Loader2 className="h-3.5 w-3.5 animate-spin" />
          ) : (
            <Plus className="h-3.5 w-3.5" />
          )}
          {label}
        </button>
      ))}
      {aiAvailable && instructionText && <Sparkles className="h-4 w-4 self-center text-primary" />}
    </div>
  )
}
 
← Back to Dashboard