From 22fd6b3c4cc207556ea3dbe9d6276e72bca4ac59 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 28 Jun 2022 18:04:54 +0100 Subject: [PATCH] feat: crossbell renovation - remove account profile page --- src/components/dashboard/DashboardLayout.tsx | 7 -- .../dashboard/[subdomain]/account/profile.tsx | 98 ------------------- 2 files changed, 105 deletions(-) delete mode 100644 src/pages/dashboard/[subdomain]/account/profile.tsx diff --git a/src/components/dashboard/DashboardLayout.tsx b/src/components/dashboard/DashboardLayout.tsx index dc98117d..936e9883 100644 --- a/src/components/dashboard/DashboardLayout.tsx +++ b/src/components/dashboard/DashboardLayout.tsx @@ -67,13 +67,6 @@ export function DashboardLayout({ icon: "i-bi-gear", text: "Settings", }, - { - href: `/dashboard/${subdomain}/account/profile`, - isActive: ({ pathname }) => - pathname.startsWith(`/dashboard/${subdomain}/account`), - icon: "i-bi-person", - text: "Account", - }, ] return ( diff --git a/src/pages/dashboard/[subdomain]/account/profile.tsx b/src/pages/dashboard/[subdomain]/account/profile.tsx deleted file mode 100644 index b1d2a69e..00000000 --- a/src/pages/dashboard/[subdomain]/account/profile.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { useEffect } from "react" -import { useForm } from "react-hook-form" -import toast from "react-hot-toast" -import { AvatarForm } from "~/components/dashboard/AvatarForm" -import { DashboardLayout } from "~/components/dashboard/DashboardLayout" -import { SettingsLayout } from "~/components/dashboard/SettingsLayout" -import { Button } from "~/components/ui/Button" -import { Input } from "~/components/ui/Input" -import { trpc } from "~/lib/trpc" - -export default function AccountProfilePage() { - const viewer = trpc.useQuery(["auth.viewer"], { - refetchOnWindowFocus: false, - refetchOnReconnect: false, - }) - const { - mutate: updateProfile, - status: updateProfileStatus, - error: updateProfileError, - } = trpc.useMutation("user.updateProfile") - - const { setValue, handleSubmit, register } = useForm({ - defaultValues: { - name: "", - username: "", - bio: "", - email: "", - }, - }) - - const onSubmit = handleSubmit((values) => { - updateProfile(values) - }) - - useEffect(() => { - if (updateProfileStatus === "success") { - toast.success("Saved!") - } else if (updateProfileStatus === "error" && updateProfileError) { - toast.error(updateProfileError.message) - } - }, [updateProfileStatus, updateProfileError]) - - useEffect(() => { - if (viewer.data) { - setValue("name", viewer.data.name) - setValue("username", viewer.data.username) - setValue("bio", viewer.data.bio || "") - setValue("email", viewer.data.email || "") - } - }, [viewer.data, setValue]) - - return ( - - - {viewer.data && ( -
- - -
- )} -
-
- -
-
- -
-
- -
-
- -
-
-
-
- ) -}