-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TOOL-3525] Dashboard: Add Delete Account in account settings page
- Loading branch information
Showing
8 changed files
with
257 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox"; | ||
import { Label } from "@/components/ui/label"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/ui/select"; | ||
import { getThirdwebClient } from "@/constants/thirdweb.server"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { useState } from "react"; | ||
|
@@ -40,6 +48,13 @@ function Variants() { | |
const [isVerifiedEmail, setIsVerifiedEmail] = useState(true); | ||
const [sendEmailFails, setSendEmailFails] = useState(false); | ||
const [emailConfirmationFails, setEmailConfirmationFails] = useState(false); | ||
const [deleteAccountStatusResponse, setDeleteAccountStatusResponse] = | ||
useState<400 | 402 | 500 | 200>(200); | ||
|
||
const deleteAccountStub = async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
return { status: deleteAccountStatusResponse }; | ||
}; | ||
|
||
return ( | ||
<div className="container flex max-w-[1132px] flex-col gap-10 py-10"> | ||
|
@@ -67,9 +82,37 @@ function Variants() { | |
/> | ||
Email Confirmation Fails | ||
</CheckboxWithLabel> | ||
|
||
<div className="mt-3 flex flex-col gap-2"> | ||
<Label>Delete Account Response</Label> | ||
<Select | ||
value={String(deleteAccountStatusResponse)} | ||
onValueChange={(value) => | ||
setDeleteAccountStatusResponse( | ||
Number(value) as 400 | 402 | 500 | 200, | ||
) | ||
} | ||
> | ||
<SelectTrigger className="min-w-[320px]"> | ||
<SelectValue placeholder="Select status" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
<SelectItem value="200">200 - Success</SelectItem> | ||
<SelectItem value="400">400 - Active Subscriptions</SelectItem> | ||
<SelectItem value="402">402 - Unpaid Invoices</SelectItem> | ||
<SelectItem value="500">500 - Unknown Error</SelectItem> | ||
</SelectContent> | ||
</Select> | ||
</div> | ||
</div> | ||
|
||
<AccountSettingsPageUI | ||
defaultTeamSlug="foo" | ||
defaultTeamName="Foo" | ||
redirectToBillingPortal={async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
return { status: 200 }; | ||
}} | ||
account={{ | ||
name: "John Doe", | ||
email: "[email protected]", | ||
|
@@ -96,6 +139,10 @@ function Variants() { | |
throw new Error("Email already exists"); | ||
} | ||
}} | ||
deleteAccount={deleteAccountStub} | ||
onAccountDeleted={() => { | ||
console.log("Account deleted"); | ||
}} | ||
/> | ||
<Toaster richColors /> | ||
</div> | ||
|
Oops, something went wrong.