'use client' import { useRef, useState, useCallback, type ReactNode } from 'react' import { ListPlus } from 'lucide-react' const THRESHOLD = 60 export function SwipeableRow({ onSwipeRight, children, }: { onSwipeRight: () => void children: ReactNode }) { const touchStartX = useRef(0) const [offset, setOffset] = useState(0) const [swiping, setSwiping] = useState(false) const [confirmed, setConfirmed] = useState(false) const handleTouchStart = useCallback((e: React.TouchEvent) => { touchStartX.current = e.touches[0].clientX setSwiping(true) }, []) const handleTouchMove = useCallback((e: React.TouchEvent) => { if (!swiping) return const delta = e.touches[0].clientX - touchStartX.current // Only allow right swipe, cap at 120px setOffset(Math.max(0, Math.min(delta, 120))) }, [swiping]) const handleTouchEnd = useCallback(() => { if (offset > THRESHOLD) { onSwipeRight() setConfirmed(true) setTimeout(() => setConfirmed(false), 600) } setOffset(0) setSwiping(false) }, [offset, onSwipeRight]) return (