import { deleteAccount } from "~/fns/account-data"; import { useAction } from "~/hooks/use-action"; import { Button } from "~/ui/Button"; import { Callout, ErrorBanner } from "~/ui/Callout"; import { TextField } from "~/ui/Field"; import { Panel } from "~/ui/Panel"; import { TextLink } from "~/ui/TextLink"; type Props = { account: string; hasPassword: boolean; soleOwnedOrgs: string[] }; export function DeleteAccountPanel({ account, hasPassword, soleOwnedOrgs }: Props) { const remove = useAction(deleteAccount, { invalidate: false }); const blocked = soleOwnedOrgs.length > 0; return (
{ event.preventDefault(); const form = new FormData(event.currentTarget); const result = await remove.run({ data: { confirm: String(form.get("confirm") ?? ""), password: String(form.get("password") ?? "") }, }); if (result) window.location.assign("/"); }} >

This permanently deletes your repositories, sites, runners, tokens, keys, stars and settings, cancels any subscription immediately (the current period is not refunded), and retires the username{" "} {account}. Issues, pull requests and comments on other people's repositories stay, shown as written by “ghost”. See the{" "} Privacy Policy. Export your data first if you want a copy.

{blocked ? ( You are the only owner of{" "} {soleOwnedOrgs.map((org, index) => ( {index > 0 && ", "} {org} ))} . Add another owner or delete {soleOwnedOrgs.length === 1 ? "it" : "them"} before deleting your account. ) : ( <> {hasPassword ? ( ) : (

Your account has no password, so you must have signed in within the last 15 minutes.

)} )}
); }