diff --git a/components/pages/inspector/AccountActions.tsx b/components/pages/inspector/AccountActions.tsx index 449f055..93012f5 100644 --- a/components/pages/inspector/AccountActions.tsx +++ b/components/pages/inspector/AccountActions.tsx @@ -7,6 +7,7 @@ import type { Account } from "@/lib/db"; import { User } from "revolt-api"; import { cancelAccountDeletion, + changeAccountEmail, disableAccount, queueAccountDeletion, restoreAccount, @@ -24,6 +25,8 @@ import { AlertDialogTitle, AlertDialogTrigger, } from "../../ui/alert-dialog"; +import { AlertDialogDescription } from "@radix-ui/react-alert-dialog"; +import { Input } from "@/components/ui/input"; dayjs.extend(relativeTime); export function AccountActions({ @@ -36,9 +39,54 @@ export function AccountActions({ const { toast } = useToast(); const [accountDraft, setAccountDraft] = useState(account); + const [emailDraft, setEmailDraft] = useState(""); return (
+ + + + + + + + Update account email + + + setEmailDraft(e.currentTarget.value)} + value={emailDraft} + /> + + + + Cancel + { + try { + await changeAccountEmail(account._id, emailDraft); + setEmailDraft(""); + toast({ title: "Updated email" }); + window.location.reload(); + } catch (err) { + toast({ + title: "Failed to execute action", + description: String(err), + variant: "destructive", + }); + } + }} + > + Change + + + + +