From 8badbeacf1e24ee81b1dc4da7bdac4a80a022c09 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Mon, 26 Oct 2026 12:19:52 +0700 Subject: [PATCH] fix(auth): show the desktop welcome sign-in once per session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dismissal was stored in localStorage, so one early ✕ suppressed the prompt forever. Switch to sessionStorage (key skatespots:desktop-welcome-snoozed): it reappears in a new tab/session but respects 'keep browsing' for the current one. --- AGENTS.md | 4 +++- src/components/Layout.tsx | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 6e5d7a4..e2b5cd6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1525,7 +1525,9 @@ session with **no other memory of this project**. So: - **Desktop welcome sign-in modal (2026-10-26):** `Layout` opens the themed `LoginDialog` **once** for a logged-out **desktop** visitor (non-native, `min-width: 1024px`, after ~900 ms) as a welcome/sign-in offer; dismissal is - remembered in `skatespots:desktop-welcome-dismissed`, and it also offers the + remembered in `sessionStorage['skatespots:desktop-welcome-snoozed']` (per + session, not forever — a single ✕ must not suppress it permanently), and it + also offers the normal `SignupDialog`. It reuses the existing methods (browser extension, bunker/signer, Amber on Android, nsec, and the **NostrConnect QR**). **3-card restyle (2026-10-26):** `LoginDialog` now leads with a **three-card diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 6e6fa88..41563e9 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -518,20 +518,21 @@ export function Layout({ children, noPadding }: LayoutProps) { const { currentMessage, dismissCurrentMessage } = useSasquatchGuide(); const { user } = useCurrentUser(); - // Desktop, logged-out, first visit: offer the sign-in modal once. Reuses the - // themed LoginDialog/SignupDialog (extension, bunker/signer, Amber, nsec, - // NostrConnect QR). Dismissal is remembered so it never nags again. - const WELCOME_LOGIN_DISMISSED = 'skatespots:desktop-welcome-dismissed'; + // Desktop, logged-out welcome: shows once per browser session (not forever — + // a single ✕ used to suppress it permanently). `sessionStorage` survives a + // reload but not a new tab/session, so "keep browsing" is respected without + // killing the prompt for future visits. + const WELCOME_LOGIN_SNOOZED = 'skatespots:desktop-welcome-snoozed'; const [showWelcomeLogin, setShowWelcomeLogin] = useState(false); const [showWelcomeSignup, setShowWelcomeSignup] = useState(false); const dismissWelcomeLogin = () => { - try { localStorage.setItem(WELCOME_LOGIN_DISMISSED, '1'); } catch { /* ignore */ } + try { sessionStorage.setItem(WELCOME_LOGIN_SNOOZED, '1'); } catch { /* ignore */ } setShowWelcomeLogin(false); }; useEffect(() => { if (user || isNativePlatform()) return; try { - if (localStorage.getItem(WELCOME_LOGIN_DISMISSED) === '1') return; + if (sessionStorage.getItem(WELCOME_LOGIN_SNOOZED) === '1') return; } catch { return; } if (typeof window === 'undefined' || !window.matchMedia?.('(min-width: 1024px)').matches) return; const timer = window.setTimeout(() => setShowWelcomeLogin(true), 900);