'use client'; import type { KeyboardEvent } from 'react'; import { copy } from '@/shared/i18n'; import { cn } from '@/shared/lib/cn'; import { useHoldToConfirm } from '../model/useHoldToConfirm'; interface ExitHoldButtonProps { variant: 'bar' | 'ring'; onConfirm: () => void; className?: string; } const RING_RADIUS = 13; const RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS; export const ExitHoldButton = ({ variant, onConfirm, className, }: ExitHoldButtonProps) => { const { progress, isHolding, isCompleted, start, cancel } = useHoldToConfirm(onConfirm); const ringOffset = RING_CIRCUMFERENCE * (1 - progress); const handleKeyDown = (event: KeyboardEvent) => { if (event.key === ' ' || event.key === 'Enter') { event.preventDefault(); start(); } }; const handleKeyUp = (event: KeyboardEvent) => { if (event.key === ' ' || event.key === 'Enter') { event.preventDefault(); cancel(); } }; if (variant === 'ring') { return ( ); } return ( ); };