import { useState } from 'react' import { Loader2, AlertTriangle, RotateCcw, Trash2, Check, X } from 'lucide-react' import { useResetProject } from '../hooks/useProjects' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, } from '@/components/ui/dialog' import { Button } from '@/components/ui/button' import { Alert, AlertDescription } from '@/components/ui/alert' interface ResetProjectModalProps { isOpen: boolean projectName: string onClose: () => void onResetComplete?: (wasFullReset: boolean) => void } export function ResetProjectModal({ isOpen, projectName, onClose, onResetComplete, }: ResetProjectModalProps) { const [resetType, setResetType] = useState<'quick' | 'full'>('quick') const resetProject = useResetProject(projectName) const handleReset = async () => { const isFullReset = resetType === 'full' try { await resetProject.mutateAsync(isFullReset) onResetComplete?.(isFullReset) onClose() } catch { // Error is handled by the mutation state } } const handleClose = () => { if (!resetProject.isPending) { resetProject.reset() setResetType('quick') onClose() } } return ( !open && handleClose()}> Reset Project Reset {projectName} to start fresh
{/* Reset Type Toggle */}
{/* Warning Box */}
{resetType === 'quick' ? 'What will be deleted:' : 'What will be deleted:'}
  • All features and progress
  • Assistant chat history
  • Agent settings
  • {resetType === 'full' && (
  • App spec and prompts
  • )}
{/* What will be preserved */}
{resetType === 'quick' ? 'What will be preserved:' : 'What will be preserved:'}
    {resetType === 'quick' ? ( <>
  • App spec and prompts
  • Project code and files
  • ) : ( <>
  • Project code and files
  • Setup wizard will appear
  • )}
{/* Error Message */} {resetProject.isError && ( {resetProject.error instanceof Error ? resetProject.error.message : 'Failed to reset project. Please try again.'} )}
) }