//=========================================== // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template //=========================================== import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, Typography } from "@hexclave/ui"; import { useState } from "react"; import { useStackApp, useUser } from "../../../lib/hooks"; import { useTranslation } from "../../../lib/translations"; import { Section } from "../section"; export function DeleteAccountSection(props?: { mockMode?: boolean }) { const { t } = useTranslation(); const user = useUser({ or: props?.mockMode ? 'return-null' : 'redirect' }); const app = useStackApp(); const project = app.useProject(); const [deleting, setDeleting] = useState(false); // In mock mode, always show the delete section const showDeleteSection = props?.mockMode || project.config.clientUserDeletionEnabled; if (!showDeleteSection) { return null; } const handleDeleteAccount = async () => { if (props?.mockMode) { // Mock mode - just show an alert alert("Mock mode: Account deletion clicked"); setDeleting(false); return; } if (user) { await user.delete(); await app.redirectToHome(); } }; return (
{t("Danger zone")} {!deleting ? (
) : (
{t("Are you sure you want to delete your account? This action is IRREVERSIBLE and will delete ALL associated data.")}
)}
); }