From 16abf1162d8148b3a27739fa48730f797c4f8bed Mon Sep 17 00:00:00 2001 From: AugustinSorel Date: Mon, 1 Jul 2024 19:23:57 +0100 Subject: [PATCH 01/14] FEAT/delete account --- src/app/_components/header.tsx | 59 -------------- src/app/account/_components/card.tsx | 33 ++++++-- .../_components/deleteUserAccountCard.tsx | 77 +++++++++++++++++++ src/app/account/_components/userTeams.tsx | 20 ++--- src/app/account/layout.tsx | 2 +- src/app/account/page.tsx | 10 ++- 6 files changed, 121 insertions(+), 80 deletions(-) create mode 100644 src/app/account/_components/deleteUserAccountCard.tsx diff --git a/src/app/_components/header.tsx b/src/app/_components/header.tsx index 5cc78db5..5307b5d2 100644 --- a/src/app/_components/header.tsx +++ b/src/app/_components/header.tsx @@ -9,7 +9,6 @@ import { Palette, Github, User, - Trash, LogOut, ChevronsUpDown, Check, @@ -43,17 +42,6 @@ import { import { signOut, useSession } from "next-auth/react"; import { Loader } from "@/components/ui/loader"; import { useParams, usePathname } from "next/navigation"; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, - AlertDialogTrigger, -} from "@/components/ui/alert-dialog"; import { useWeightUnit } from "@/context/weightUnit"; import type { Exercise } from "@/server/db/types"; import { type RouterOutputs, api } from "@/trpc/react"; @@ -113,8 +101,6 @@ const DropDownMenu = () => { - - )} @@ -258,51 +244,6 @@ const SignOutDropDownItem = () => { ); }; -const DeleteAccountDropDownItem = () => { - const deleteAccount = api.user.delete.useMutation({ - onSuccess: async () => { - await signOut({ callbackUrl: "/" }); - }, - }); - - return ( - - - e.preventDefault()} - > - - delete account - - - - - - Are you absolutely sure? - - This action cannot be undone. This will permanently delete your - account and remove your data from our servers. - - - - cancel - { - e.preventDefault(); - void deleteAccount.mutate(); - }} - > - {deleteAccount.isPending && } - delete - - - - - ); -}; - const HomeIcon = ({ children }: PropsWithChildren) => { const { data: session } = useSession(); diff --git a/src/app/account/_components/card.tsx b/src/app/account/_components/card.tsx index a704515a..d77579c1 100644 --- a/src/app/account/_components/card.tsx +++ b/src/app/account/_components/card.tsx @@ -8,7 +8,7 @@ const Root = (props: ComponentPropsWithoutRef<"section">) => {
@@ -23,13 +23,15 @@ const ErrorFallback = (props: FallbackProps) => { return ( - Something else wrong - - Error: {errorMessage} - - + + Something else wrong + + Error: {errorMessage} + + + ); }; @@ -47,9 +49,24 @@ const Description = (props: ComponentPropsWithoutRef<"p">) => { return

; }; +const Body = (props: ComponentPropsWithoutRef<"div">) => { + return

; +}; + +const Footer = (props: ComponentPropsWithoutRef<"footer">) => { + return ( +