From f2db84eecca5e6aa37c96c2fda8c76b3bc7e2bf5 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Sat, 14 Mar 2026 20:37:27 -0400 Subject: [PATCH] add confirm to domain delete --- components/Domains/DomainSettingsView.tsx | 81 +++++++++++++++++------ 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/components/Domains/DomainSettingsView.tsx b/components/Domains/DomainSettingsView.tsx index 406a8d12..02782036 100644 --- a/components/Domains/DomainSettingsView.tsx +++ b/components/Domains/DomainSettingsView.tsx @@ -9,6 +9,7 @@ import { useIdentityData, mutateIdentityData, } from "components/IdentityProvider"; +import { ButtonPrimary } from "components/Buttons"; import { getDomainAssignment } from "./domainAssignment"; export function DomainSettingsView(props: { @@ -197,25 +198,67 @@ export function DomainSettingsView(props: {
-
- {props.onDeleteDomain && ( - - )} -
+ + + + ); +} + +function DeleteDomainButton(props: { + domain: string; + onDeleteDomain?: () => void; + mutateIdentity: ReturnType["mutate"]; +}) { + let [confirming, setConfirming] = useState(false); + + if (!props.onDeleteDomain) return null; + + if (!confirming) { + return ( +
+ +
+ ); + } + + return ( +
+

+ Are you sure you want to delete {props.domain}? This + will remove all assignments and cannot be undone. +

+
+ + { + mutateIdentityData(props.mutateIdentity, (draft) => { + draft.custom_domains = draft.custom_domains.filter( + (d) => d.domain !== props.domain, + ); + }); + props.onDeleteDomain?.(); + await deleteDomain({ domain: props.domain }); + }} + > + Delete +
); -- 2.51.2