From 72c51adbb3eac175b8288dc8bded5bcface2a444 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Mon, 28 Sep 2026 14:50:07 -0600 Subject: [PATCH 1/2] Separate account deletion from the routine profile options so it reads as a destructive action. Co-authored-by: Cursor --- .../profile/_components/ProfilePage.view.tsx | 38 +++-- tests/pages/profile.test.tsx | 143 ++++++++++++++++++ 2 files changed, 170 insertions(+), 11 deletions(-) create mode 100644 tests/pages/profile.test.tsx diff --git a/app/(app)/profile/_components/ProfilePage.view.tsx b/app/(app)/profile/_components/ProfilePage.view.tsx index 09f80f2..18cf267 100644 --- a/app/(app)/profile/_components/ProfilePage.view.tsx +++ b/app/(app)/profile/_components/ProfilePage.view.tsx @@ -237,17 +237,8 @@ export function ProfilePageView({ leadingIcon: "mail", showDescription: false, }, - { - id: "delete-account", - title: t("deleteAccount"), - description: "", - onClick: onOpenDeleteAccount, - leadingIcon: "warning", - variant: "danger", - showDescription: false, - }, ]; - }, [t, onSignOut, onOpenDeleteAccount, onOpenEmailChange, onStartNewCustomRule]); + }, [t, onSignOut, onOpenEmailChange, onStartNewCustomRule]); const ruleCardShellClass = "w-full !max-w-full cursor-default !gap-3 !rounded-[12px] shadow-[0_0_48px_rgba(0,0,0,0.1)] lg:!rounded-[24px] lg:shadow-[0_0_24px_rgba(0,0,0,0.1)]"; @@ -408,6 +399,31 @@ export function ProfilePageView({ + +
+

+ {t("deleteAccount")} +

+

+ {t("deleteAccountIntro")} +

+ +
@@ -502,7 +518,7 @@ export function ProfilePageView({ - diff --git a/app/components/layout/ListEntry/ListEntry.view.tsx b/app/components/layout/ListEntry/ListEntry.view.tsx index 3380d3d..b09534c 100644 --- a/app/components/layout/ListEntry/ListEntry.view.tsx +++ b/app/components/layout/ListEntry/ListEntry.view.tsx @@ -51,15 +51,8 @@ const ListEntryRow = memo(function ListEntryRow({ ? `${layout.title} !text-[var(--color-content-default-negative-primary)]` : layout.title; - const leadingToneClass = - variant === "danger" - ? "text-[var(--color-content-default-negative-primary)]" - : "text-[var(--color-content-default-primary)]"; - - const chevronToneClass = - variant === "danger" - ? "text-[var(--color-content-default-negative-primary)]" - : "text-[var(--color-content-default-primary)]"; + const leadingToneClass = "text-[var(--color-content-default-primary)]"; + const chevronToneClass = "text-[var(--color-content-default-primary)]"; const leadingSlot = (
diff --git a/tests/pages/profile.test.tsx b/tests/pages/profile.test.tsx index 486e906..cdfb35e 100644 --- a/tests/pages/profile.test.tsx +++ b/tests/pages/profile.test.tsx @@ -69,34 +69,36 @@ function viewProps( } describe("ProfilePageView", () => { - test("keeps account deletion out of the routine options list", () => { + test("puts delete account in its own danger area", () => { render(); const options = screen.getByRole("navigation", { name: copy.yourOptionsHeading, }); - const createRule = within(options).getByRole("button", { - name: copy.optionCreateCustom, - }); - expect(createRule.closest("ul")).not.toBeNull(); expect( - within(options).queryByRole("button", { name: copy.deleteAccountConfirm }), - ).not.toBeInTheDocument(); + within(options).getByRole("button", { name: copy.optionCreateCustom }), + ).toBeInTheDocument(); expect( - within(options).queryByRole("heading", { name: copy.deleteAccount }), + within(options).queryByRole("button", { name: copy.deleteAccount }), ).not.toBeInTheDocument(); + expect(screen.queryByText(copy.deleteAccountIntro)).not.toBeInTheDocument(); const danger = screen.getByRole("region", { name: copy.deleteAccount }); - expect(danger).toHaveTextContent(copy.deleteAccountIntro); - const deleteAccount = within(danger).getByRole("button", { - name: copy.deleteAccountConfirm, - }); - expect(deleteAccount.closest("ul")).toBeNull(); - expect(deleteAccount.className).toContain( + expect(danger.className).toContain( "border-[var(--color-border-default-negative-primary)]", ); - expect(deleteAccount.className).not.toContain( - "bg-[var(--color-surface-inverse-primary)]", + const deleteAccount = within(danger).getByRole("button", { + name: copy.deleteAccount, + }); + const deleteTitle = within(deleteAccount).getByText(copy.deleteAccount); + expect(deleteTitle.className).toContain( + "!text-[var(--color-content-default-negative-primary)]", + ); + expect(deleteAccount.firstElementChild?.className).not.toContain( + "negative-primary", + ); + expect(deleteAccount.lastElementChild?.className).not.toContain( + "negative-primary", ); }); @@ -109,7 +111,7 @@ describe("ProfilePageView", () => { ); await user.click( - screen.getByRole("button", { name: copy.deleteAccountConfirm }), + screen.getByRole("button", { name: copy.deleteAccount }), ); expect(onOpenDeleteAccount).toHaveBeenCalledTimes(1); -- 2.53.0