-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reintroduce the "delete account" action
This re-introduces the "Delete Account/Organization" action within the account / organization admin.
- Loading branch information
Showing
3 changed files
with
149 additions
and
20 deletions.
There are no files selected for viewing
13 changes: 10 additions & 3 deletions
13
src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.test.tsx
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
91 changes: 74 additions & 17 deletions
91
src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.tsx
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
65 changes: 65 additions & 0 deletions
65
src/pages/AccountSettings/tabs/DeletionCard/EraseOwnerModal.tsx
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import Button from 'ui/Button' | ||
import Modal from 'ui/Modal' | ||
|
||
interface EraseOwnerModelProps { | ||
isPersonalSettings: boolean | ||
isLoading: boolean | ||
showModal: boolean | ||
closeModal: () => void | ||
eraseOwner: () => void | ||
} | ||
|
||
function EraseOwnerModal({ | ||
isPersonalSettings, | ||
closeModal, | ||
eraseOwner, | ||
isLoading, | ||
showModal, | ||
}: EraseOwnerModelProps) { | ||
const title = isPersonalSettings | ||
? 'Are you sure you want to delete your personal account?' | ||
: 'Are you sure you want to erase this organization?' | ||
let text = isPersonalSettings | ||
? 'This action will delete all personal data, including login information and personal tokens.' | ||
: 'This action will delete all organization content and associated tokens.' | ||
text += | ||
' It will also erase all of the repositories, including all of their contents.' | ||
text += | ||
' This action is irreversible and if you proceed, you will permanently erase all of the associated content.' | ||
const button = isPersonalSettings | ||
? 'Erase Personal Account' | ||
: 'Erase Organization' | ||
|
||
return ( | ||
<Modal | ||
isOpen={showModal} | ||
onClose={closeModal} | ||
title={title} | ||
body={<p>{text}</p>} | ||
footer={ | ||
<div className="flex gap-2"> | ||
<div> | ||
<Button hook="close-modal" onClick={closeModal}> | ||
Cancel | ||
</Button> | ||
</div> | ||
<div> | ||
<Button | ||
isLoading={isLoading} | ||
hook="erase-owner-content" | ||
variant="danger" | ||
onClick={async () => { | ||
await eraseOwner() | ||
closeModal() | ||
}} | ||
> | ||
{button} | ||
</Button> | ||
</div> | ||
</div> | ||
} | ||
/> | ||
) | ||
} | ||
|
||
export default EraseOwnerModal |