From 1af342da2dcff89c789b99de456d66ca03074ca1 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Wed, 4 Feb 2026 11:04:52 +0000 Subject: [PATCH] fix: add 7-day snooze cooldown to GitHub star modal "Maybe later" previously only hid the modal for the current session, causing it to reappear on every subsequent visit. Now it snoozes the modal for 7 days before showing again. --- .../src/components/GitHubStarBanner.tsx | 19 +++++++++++++++++-- frontend-modern/src/utils/localStorage.ts | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend-modern/src/components/GitHubStarBanner.tsx b/frontend-modern/src/components/GitHubStarBanner.tsx index f994bff7f..0ccc972a7 100644 --- a/frontend-modern/src/components/GitHubStarBanner.tsx +++ b/frontend-modern/src/components/GitHubStarBanner.tsx @@ -26,6 +26,12 @@ export function GitHubStarBanner() { '' ); + // Track snooze date (when "Maybe later" was clicked, don't show again until this date) + const [snoozedUntil, setSnoozedUntil] = createLocalStorageStringSignal( + STORAGE_KEYS.GITHUB_STAR_SNOOZED_UNTIL, + '' + ); + const [showModal, setShowModal] = createSignal(false); // Check if user qualifies to see the modal @@ -61,6 +67,13 @@ export function GitHubStarBanner() { return; } + // Still within snooze period? Don't show + const snoozeDate = snoozedUntil(); + if (snoozeDate && today < snoozeDate) { + setShowModal(false); + return; + } + // Returning user (different day than first seen)? Show the modal if (firstSeen !== today) { setShowModal(true); @@ -80,8 +93,10 @@ export function GitHubStarBanner() { }; const handleMaybeLater = () => { - // Just close for this session, but don't permanently dismiss - // They'll see it again next time they return + // Snooze for 7 days before showing again + const snoozeDate = new Date(); + snoozeDate.setDate(snoozeDate.getDate() + 7); + setSnoozedUntil(snoozeDate.toISOString().split('T')[0]); setShowModal(false); }; diff --git a/frontend-modern/src/utils/localStorage.ts b/frontend-modern/src/utils/localStorage.ts index fd5b37c75..a0c13e0a0 100644 --- a/frontend-modern/src/utils/localStorage.ts +++ b/frontend-modern/src/utils/localStorage.ts @@ -168,6 +168,7 @@ export const STORAGE_KEYS = { // GitHub star prompt GITHUB_STAR_DISMISSED: 'pulse-github-star-dismissed', GITHUB_STAR_FIRST_SEEN: 'pulse-github-star-first-seen', + GITHUB_STAR_SNOOZED_UNTIL: 'pulse-github-star-snoozed-until', // Audit log AUDIT_AUTO_VERIFY: 'pulse-audit-auto-verify',