Add profile pictures to people and fix account/workspace deletion (#984)
* Fix LinkedIn URL not redirecting to the right url * add avatars for people and seeds * Fix delete account/workspace * Add people picture on other pages * Change style of delete button * Revert modal to previous size * Fix tests
This commit is contained in:
@ -5,21 +5,15 @@ import { useAuth } from '@/auth/hooks/useAuth';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { ButtonVariant } from '@/ui/button/components/Button';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
import {
|
||||
useDeleteCurrentWorkspaceMutation,
|
||||
useDeleteUserAccountMutation,
|
||||
} from '~/generated/graphql';
|
||||
import { useDeleteCurrentWorkspaceMutation } from '~/generated/graphql';
|
||||
|
||||
import { DeleteModal, StyledDeleteButton } from './DeleteModal';
|
||||
|
||||
export function DeleteWorkspace() {
|
||||
const [isDeleteWorkSpaceModalOpen, setIsDeleteWorkSpaceModalOpen] =
|
||||
useState(false);
|
||||
const [isDeleteAccountModalOpen, setIsDeleteAccountModalOpen] =
|
||||
useState(false);
|
||||
|
||||
const [deleteCurrentWorkspace] = useDeleteCurrentWorkspaceMutation();
|
||||
const [deleteUserAccount] = useDeleteUserAccountMutation();
|
||||
const { signOut } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@ -33,16 +27,6 @@ export function DeleteWorkspace() {
|
||||
handleLogout();
|
||||
};
|
||||
|
||||
const deleteAccount = async () => {
|
||||
await deleteUserAccount();
|
||||
handleLogout();
|
||||
};
|
||||
|
||||
const subtitle = (
|
||||
type: 'workspace' | 'account',
|
||||
) => `This action cannot be undone. This will permanently delete your
|
||||
entire ${type}. Please type in your email to confirm.`;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SubSectionTitle
|
||||
@ -55,33 +39,19 @@ export function DeleteWorkspace() {
|
||||
title="Delete workspace"
|
||||
/>
|
||||
|
||||
<SubSectionTitle
|
||||
title=""
|
||||
description="Delete account and all the associated data"
|
||||
/>
|
||||
<StyledDeleteButton
|
||||
onClick={() => setIsDeleteAccountModalOpen(true)}
|
||||
variant={ButtonVariant.Secondary}
|
||||
title="Delete account"
|
||||
/>
|
||||
|
||||
<DeleteModal
|
||||
isOpen={isDeleteWorkSpaceModalOpen}
|
||||
setIsOpen={setIsDeleteWorkSpaceModalOpen}
|
||||
title="Workspace Deletion"
|
||||
subtitle={subtitle('workspace')}
|
||||
subtitle={
|
||||
<>
|
||||
This action cannot be undone. This will permanently delete your
|
||||
entire workspace. <br /> Please type in your email to confirm.
|
||||
</>
|
||||
}
|
||||
handleConfirmDelete={deleteWorkspace}
|
||||
deleteButtonText="Delete workspace"
|
||||
/>
|
||||
|
||||
<DeleteModal
|
||||
isOpen={isDeleteAccountModalOpen}
|
||||
setIsOpen={setIsDeleteAccountModalOpen}
|
||||
title="Account Deletion"
|
||||
subtitle={subtitle('account')}
|
||||
handleConfirmDelete={deleteAccount}
|
||||
deleteButtonText="Delete account"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user