"use client"; import { useState } from "react"; import { api } from "@/lib/api"; import { useToast } from "@/lib/toast-context"; import { RotateCcw } from "lucide-react"; import { Modal } from "@/components/ui/Modal"; import { Button } from "@/components/ui/Button"; interface RemoveProgressButtonProps { audiobookId: string; onProgressRemoved?: () => void; } export function RemoveProgressButton({ audiobookId, onProgressRemoved, }: RemoveProgressButtonProps) { const [isRemoving, setIsRemoving] = useState(false); const [showConfirmModal, setShowConfirmModal] = useState(false); const { toast } = useToast(); const handleRemoveProgress = async () => { setShowConfirmModal(false); setIsRemoving(true); try { await api.deleteAudiobookProgress(audiobookId); toast.success("Progress removed"); onProgressRemoved?.(); } catch (error) { console.error("Failed to remove progress:", error); toast.error("Failed to remove progress"); } finally { setIsRemoving(false); } }; return ( <> setShowConfirmModal(false)} title="Remove Progress" footer={ <> } >

Remove your progress for this audiobook? This will reset your position to the beginning.

This action cannot be undone.

); }