import ProfileController from '@/actions/App/Http/Controllers/Settings/ProfileController'; import HeadingSmall from '@/components/heading-small'; import InputError from '@/components/input-error'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { Label } from '@/components/ui/label'; import { PasswordInput } from '@/components/ui/password-input'; import { billing } from '@/routes/settings'; import { type SharedData } from '@/types'; import { __ } from '@/utils/i18n'; import { Form, Link, usePage } from '@inertiajs/react'; import { InfoIcon } from 'lucide-react'; import { useRef } from 'react'; export default function DeleteUser({ hasActiveSubscriptionOrTrial, }: { hasActiveSubscriptionOrTrial: boolean; }) { const { auth } = usePage().props; const isDemoAccount = auth?.isDemoAccount ?? false; const passwordInput = useRef(null); if (isDemoAccount) { return (
{__('The demo account cannot be deleted.')}
); } if (hasActiveSubscriptionOrTrial) { return (
{__( 'Please cancel your subscription before deleting your account.', )}
); } return (

{__('Warning')}

{__( 'Please proceed with caution, this cannot be undone.', )}

{__( 'Are you sure you want to delete your account?', )} {__( 'Once your account is deleted, you will be signed out\n and your access will be disabled. Your data will\n remain in the database. Please enter your password\n to confirm you would like to mark your account as\n deleted.', )}
passwordInput.current?.focus()} resetOnSuccess className="space-y-6" > {({ resetAndClearErrors, processing, errors }) => ( <>
)}
); }