From d885fc7458d81543cbfbb3e18cd6a1accb6c19ac Mon Sep 17 00:00:00 2001 From: anthony lio Date: Tue, 24 Nov 2026 16:08:54 +0200 Subject: [PATCH] feat(www): shared account menu (#53666) ## Problem - www keeps its own copy of the account menu items separate from the shared top nav menu in kb and docs - www header buttons stay hidden until auth loads and the mobile menu shows no account links during that time - on app router page such as the home page sign out does not reload the page ## Solution - moves the www desktop account menu onto the shared top nav menu so www docs and kb show the same account items - fixes "Command Menu" shortcut label to follow the platform, so windows and linux readers see "Ctrl K" - changes the header and the mobile menu to read the signed-in mark while auth loads - moves the mobile menu account links onto the shared mobile actions, so www, docs and kb use one component - changes the desktop "Sign in" links to open the sign-in page, so desktop and mobile open the same page - fixes sign out on app router pages so the page reloads after sign out on every page ## Review instructions 1. visit [homepage](https://zone-www-dot-com-git-antlio-fix-www-shared-account-menu-supabase.vercel.app/) 2. open the browser console, and run this snippet, which stores a fake dashboard session with no real token: ```js const user = { id: 'test', aud: 'authenticated', email: 'you@example.com', user_metadata: { avatar_url: 'https://github.com/supabase.png' } } const key = 'supabase.dashboard.auth.token' localStorage.setItem(key, JSON.stringify({ access_token: 'a.b.c', refresh_token: 'r', token_type: 'bearer', expires_in: 3600, expires_at: Math.floor(Date.now() / 1000) + 3600, user })) localStorage.setItem(`${key}-user`, JSON.stringify({ user }))``` 3. reload the page ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --- apps/www/app/layout.tsx | 4 ++ apps/www/components/Nav/AccountMenu.tsx | 43 ++++++++++++ apps/www/components/Nav/MobileMenu.tsx | 70 +++++++------------ apps/www/components/Nav/index.tsx | 38 ++++------ apps/www/components/Nav/useDropdownMenu.tsx | 61 ---------------- apps/www/lib/dashboard-links.ts | 5 +- apps/www/pages/_document.tsx | 5 +- .../src/MobileNav/MobileNavAccountActions.tsx | 20 +++++- 8 files changed, 110 insertions(+), 136 deletions(-) create mode 100644 apps/www/components/Nav/AccountMenu.tsx delete mode 100644 apps/www/components/Nav/useDropdownMenu.tsx diff --git a/apps/www/app/layout.tsx b/apps/www/app/layout.tsx index 7bc296cdc12..23bff1d3a60 100644 --- a/apps/www/app/layout.tsx +++ b/apps/www/app/layout.tsx @@ -4,6 +4,7 @@ import '../styles/globals.css' import '../pages/launch-week/launchWeek.css' import { inter, manrope, sourceCodePro } from '~/lib/fonts' +import { SIGNED_IN_HINT_SCRIPT } from 'common/gotrue' import { genFaviconData } from 'common/MetaFavicons/app-router' import type { Metadata, Viewport } from 'next' @@ -52,6 +53,9 @@ export default function RootLayout({ children }: { children: React.ReactNode }) suppressHydrationWarning className={`${manrope.variable} ${inter.variable} ${sourceCodePro.variable}`} > + +