diff --git a/apps/web/src/routes/_view/app/-account-access.tsx b/apps/web/src/routes/_view/app/-account-access.tsx new file mode 100644 index 0000000000..86a4ea1658 --- /dev/null +++ b/apps/web/src/routes/_view/app/-account-access.tsx @@ -0,0 +1,143 @@ +import { useMutation } from "@tanstack/react-query"; +import { useNavigate } from "@tanstack/react-router"; +import { useState } from "react"; + +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@hypr/ui/components/ui/accordion"; + +import { signOutFn } from "@/functions/auth"; +import { deleteAccount } from "@/functions/billing"; + +export function AccountAccessSection() { + const navigate = useNavigate(); + const [showDeleteConfirm, setShowDeleteConfirm] = useState(false); + + const signOut = useMutation({ + mutationFn: async () => { + const res = await signOutFn(); + if (res.success) { + return true; + } + + throw new Error(res.message); + }, + onSuccess: () => { + navigate({ to: "/" }); + }, + onError: (error) => { + console.error(error); + navigate({ to: "/" }); + }, + }); + + const deleteAccountMutation = useMutation({ + mutationFn: () => deleteAccount(), + onSuccess: () => { + navigate({ to: "/" }); + }, + }); + + return ( +
+
+

Access

+

+ Session controls and destructive account actions +

+
+ +
+
+
Sign out
+

+ End your current session on this device +

+
+ + +
+ +
+ { + if (!value) { + setShowDeleteConfirm(false); + deleteAccountMutation.reset(); + } + }} + > + + + Delete account + + +
+

+ Char is a local-first app. Your notes, transcripts, and + meeting data stay on your device. Deleting your account only + removes cloud-stored data. +

+ + {showDeleteConfirm ? ( +
+

+ This permanently deletes your account and cloud data. +

+ + {deleteAccountMutation.isError && ( +

+ {deleteAccountMutation.error?.message || + "Failed to delete account"} +

+ )} + +
+ + +
+
+ ) : ( + + )} +
+
+
+
+
+
+ ); +} diff --git a/apps/web/src/routes/_view/app/-account-delete.tsx b/apps/web/src/routes/_view/app/-account-delete.tsx deleted file mode 100644 index e886dd2244..0000000000 --- a/apps/web/src/routes/_view/app/-account-delete.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { useMutation } from "@tanstack/react-query"; -import { useNavigate } from "@tanstack/react-router"; -import { useState } from "react"; - -import { deleteAccount } from "@/functions/billing"; - -export function DeleteAccountSection() { - const navigate = useNavigate(); - const [showConfirm, setShowConfirm] = useState(false); - - const deleteAccountMutation = useMutation({ - mutationFn: () => deleteAccount(), - onSuccess: () => { - navigate({ to: "/" }); - }, - }); - - return ( -
-
-

- Delete Account -

-

- Char is a local-first app — your notes, transcripts, and meeting data - are stored locally on your device and will not be affected by account - deletion. Deleting your account only removes your cloud-stored data. -

-
- -
- {showConfirm ? ( -
-

- Are you sure? This will permanently delete your account and all - cloud-stored data. Your local data will not be affected. -

- {deleteAccountMutation.isError && ( -

- {deleteAccountMutation.error?.message || - "Failed to delete account"} -

- )} -
- - -
-
- ) : ( - - )} -
-
- ); -} diff --git a/apps/web/src/routes/_view/app/-account-sign-out.tsx b/apps/web/src/routes/_view/app/-account-sign-out.tsx deleted file mode 100644 index 860445b7e1..0000000000 --- a/apps/web/src/routes/_view/app/-account-sign-out.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { useMutation } from "@tanstack/react-query"; -import { useNavigate } from "@tanstack/react-router"; - -import { signOutFn } from "@/functions/auth"; - -export function SignOutSection() { - const navigate = useNavigate(); - - const signOut = useMutation({ - mutationFn: async () => { - const res = await signOutFn(); - if (res.success) { - return true; - } - - throw new Error(res.message); - }, - onSuccess: () => { - navigate({ to: "/" }); - }, - onError: (error) => { - console.error(error); - navigate({ to: "/" }); - }, - }); - - return ( -
-
-

Sign Out

-

End your current session

-
- -
- -
-
- ); -} diff --git a/apps/web/src/routes/_view/app/account.tsx b/apps/web/src/routes/_view/app/account.tsx index e1ddeab466..f6dba122f9 100644 --- a/apps/web/src/routes/_view/app/account.tsx +++ b/apps/web/src/routes/_view/app/account.tsx @@ -4,11 +4,10 @@ import { z } from "zod"; import { desktopSchemeSchema } from "@/functions/desktop-flow"; -import { DeleteAccountSection } from "./-account-delete"; +import { AccountAccessSection } from "./-account-access"; import { IntegrationsSettingsCard } from "./-account-integrations"; import { ProfileInfoSection } from "./-account-profile-info"; import { AccountSettingsCard } from "./-account-settings"; -import { SignOutSection } from "./-account-sign-out"; const validateSearch = z .object({ @@ -43,16 +42,48 @@ function Component() { -
- +
+
+
+

+ Account +

+
+

+ Profile, billing, and connected services +

+

+ Update the essentials without burying routine settings behind + destructive actions. +

+
+
- +
+ + + +
+
- +
+
+

+ Access +

+
+

+ Session controls +

+

+ Sign out quickly, while keeping account deletion tucked behind + an extra deliberate step. +

+
+
- - - + +