From d107c0a860757df3100169753dbe1a814909cdc3 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Fri, 24 Jul 2026 10:09:15 +0700 Subject: [PATCH] Fix Sasquatch auto-popup on / and /lab; move map attribution above mobile nav - Sasquatch panel no longer auto-opens on the map (/) or The Lab (/lab). Added an `autoShow` flag to GuideMessage; only opt-in messages (onboarding) auto-open. The bubble stays minimized until tapped, and context messages still populate the panel when opened manually. - Map CARTO/OSM attribution now sits above the mobile bottom nav (safe-area aware) instead of overlapping the Shops & Spots buttons; made it smaller and more subtle. Desktop keeps it in the bottom-left corner. Co-authored-by: shakespeare.diy --- src/components/SasquatchGuide.tsx | 18 ++++++++++++------ src/hooks/useSasquatchGuide.ts | 7 +++++++ src/pages/MapPage.tsx | 13 ++++++++----- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/components/SasquatchGuide.tsx b/src/components/SasquatchGuide.tsx index 3028d08..7725b41 100644 --- a/src/components/SasquatchGuide.tsx +++ b/src/components/SasquatchGuide.tsx @@ -114,6 +114,9 @@ export interface GuideMessage { onClick: () => void; }; enableChat?: boolean; + /** When true, the panel auto-opens on navigation. When false/undefined, the + * message only populates content once the user taps the bubble. */ + autoShow?: boolean; } interface SasquatchGuideProps { @@ -371,14 +374,16 @@ export function SasquatchGuide({ message, onDismiss }: SasquatchGuideProps) { return undefined; }, [dragPos]); + // Only auto-open the panel when the context message explicitly opts in via + // `autoShow`. On the map (`/`) and The Lab (`/lab`) the guide stays minimized + // until the user taps the bubble — the message content is still used to + // populate the panel when they do. useEffect(() => { - if (message) { + if (message?.autoShow) { const timer = setTimeout(() => setIsVisible(true), 500); return () => clearTimeout(timer); - } else { - setIsVisible(false); } - }, [message]); + }, [message?.autoShow, message?.id]); // Auto-scroll chat to bottom useEffect(() => { @@ -579,8 +584,9 @@ Instructions: }, [handleSendMessage, setIsMinimized]); // The minimized bubble is ALWAYS visible so the user can reopen Sasquatch on any page. - // The full panel shows only when there's a message or when opened externally/by user tap. - const shouldShowPanel = !!message || isVisible; + // The full panel shows only when opened externally, by user tap, or by an + // opt-in auto-show message (e.g. onboarding) — never automatically on / or /lab. + const shouldShowPanel = isVisible; // Notify the rest of the app (e.g. MapPage FAB) when the panel opens or closes useEffect(() => { diff --git a/src/hooks/useSasquatchGuide.ts b/src/hooks/useSasquatchGuide.ts index cc59e17..151a70b 100644 --- a/src/hooks/useSasquatchGuide.ts +++ b/src/hooks/useSasquatchGuide.ts @@ -74,6 +74,9 @@ export function useSasquatchGuide() { }, }, enableChat: true, + // Map homepage: don't auto-open the panel — the bubble stays minimized + // until the user taps it. + autoShow: false, }; } @@ -116,6 +119,8 @@ export function useSasquatchGuide() { }, }, enableChat: true, + // Dedicated onboarding page — auto-open is helpful here. + autoShow: true, }; } @@ -144,6 +149,8 @@ export function useSasquatchGuide() { }, }, enableChat: true, + // The Lab: don't auto-open — the bubble stays minimized until tapped. + autoShow: false, }; } diff --git a/src/pages/MapPage.tsx b/src/pages/MapPage.tsx index e45b9d1..358ebf7 100644 --- a/src/pages/MapPage.tsx +++ b/src/pages/MapPage.tsx @@ -1426,12 +1426,15 @@ export default function MapPage() { - {/* Map attribution — bottom-left corner, minimal */} -
-
- CARTO + {/* Map attribution — bottom-left, sits ABOVE the mobile bottom + nav so it never covers the Shops & Spots buttons. Tiny + subtle. */} +
+
+ CARTO {' · '} - OSM + OSM {showBtcMap && ( <>{' · '}BTC Map )}