2026-01-07 09:31:02 +00:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import { Button } from '../../ui/button';
|
|
|
|
|
import { Input } from '../../ui/input';
|
|
|
|
|
import { X, AlertTriangle, Loader2 } from 'lucide-react';
|
|
|
|
|
import { useToast } from '../../../context/ToastContext';
|
|
|
|
|
|
|
|
|
|
interface DeleteAccountConfirmModalProps {
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
onConfirm: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const DeleteAccountConfirmModal: React.FC<
|
|
|
|
|
DeleteAccountConfirmModalProps
|
|
|
|
|
> = ({ onClose, onConfirm }) => {
|
2026-01-07 09:31:02 +00:00
|
|
|
const { addToast } = useToast();
|
|
|
|
|
const [password, setPassword] = useState('');
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
|
|
|
|
|
const handleDelete = () => {
|
|
|
|
|
if (!password) {
|
2026-01-13 18:47:57 +00:00
|
|
|
addToast('Please enter your password to confirm', 'error');
|
2026-01-07 09:31:02 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setLoading(true);
|
|
|
|
|
// Simulate API call
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
onConfirm();
|
|
|
|
|
}, 2000);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="fixed inset-0 z-[60] flex items-center justify-center p-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
|
|
|
|
className="absolute inset-0 bg-kodo-void/90 backdrop-blur-sm"
|
|
|
|
|
onClick={loading ? undefined : onClose}
|
|
|
|
|
></div>
|
2026-01-07 09:31:02 +00:00
|
|
|
<div className="relative w-full max-w-md bg-kodo-graphite border border-kodo-red rounded-xl shadow-2xl overflow-hidden animate-scaleIn">
|
|
|
|
|
<div className="p-4 border-b border-kodo-red/30 bg-kodo-red/10 flex justify-between items-center">
|
|
|
|
|
<h3 className="font-bold text-kodo-red flex items-center gap-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
<AlertTriangle className="w-5 h-5 fill-current" /> PERMANENT
|
|
|
|
|
DELETION
|
2026-01-07 09:31:02 +00:00
|
|
|
</h3>
|
2026-01-13 18:47:57 +00:00
|
|
|
<button
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
disabled={loading}
|
2026-01-16 00:56:24 +00:00
|
|
|
className="text-kodo-content-dim hover:text-white disabled:opacity-50"
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
<X className="w-5 h-5" />
|
|
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="p-6 space-y-4">
|
2026-01-16 00:56:24 +00:00
|
|
|
<p className="text-kodo-text-main text-sm">
|
2026-01-13 18:47:57 +00:00
|
|
|
This is the final step. Once you click delete, your account will be
|
|
|
|
|
queued for immediate removal. You will be logged out.
|
2026-01-07 09:31:02 +00:00
|
|
|
</p>
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
<div className="bg-kodo-ink p-4 rounded border border-kodo-steel">
|
2026-01-16 00:56:24 +00:00
|
|
|
<ul className="text-xs text-kodo-content-dim space-y-2 list-disc pl-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<li>All uploaded tracks and assets will be deleted.</li>
|
|
|
|
|
<li>Your username will be released.</li>
|
|
|
|
|
<li>Any active subscriptions will be cancelled immediately.</li>
|
|
|
|
|
</ul>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
2026-01-13 18:47:57 +00:00
|
|
|
<label className="block text-sm font-bold text-white mb-2">
|
|
|
|
|
Confirm Password
|
|
|
|
|
</label>
|
|
|
|
|
<Input
|
|
|
|
|
type="password"
|
|
|
|
|
placeholder="Enter your password"
|
|
|
|
|
value={password}
|
|
|
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
|
|
|
autoFocus
|
|
|
|
|
/>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
<div className="p-4 border-t border-kodo-steel bg-kodo-ink flex justify-end gap-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Button variant="ghost" onClick={onClose} disabled={loading}>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="primary"
|
2026-01-16 00:56:24 +00:00
|
|
|
className="bg-kodo-red hover:bg-kodo-red border-kodo-red text-white"
|
2026-01-07 09:31:02 +00:00
|
|
|
onClick={handleDelete}
|
|
|
|
|
disabled={loading}
|
|
|
|
|
>
|
2026-01-13 18:47:57 +00:00
|
|
|
{loading ? (
|
|
|
|
|
<Loader2 className="w-4 h-4 animate-spin" />
|
|
|
|
|
) : (
|
|
|
|
|
'DELETE FOREVER'
|
|
|
|
|
)}
|
2026-01-07 09:31:02 +00:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2026-01-13 18:47:57 +00:00
|
|
|
};
|