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.
This commit is contained in:
rcourtman
2026-02-04 11:04:52 +00:00
parent ed0f85149d
commit 1af342da2d
2 changed files with 18 additions and 2 deletions

View File

@@ -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);
};

View File

@@ -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',