From 5bb5773141acdb77106c9763690952d455134b0f Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Sat, 7 Mar 2026 15:37:08 +0000 Subject: [PATCH] Improve push notification banner to reappear after a set time Update the push notification banner logic to dismiss for 7 days instead of indefinitely, and track dismissal using timestamps. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 23852c00-4779-460a-9e0c-d09fee4b6c92 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 9df9e674-e5e7-4e30-8a1e-b07cb5483e58 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/23852c00-4779-460a-9e0c-d09fee4b6c92/ICRgny1 Replit-Helium-Checkpoint-Created: true --- client/src/components/push-prompt-banner.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/components/push-prompt-banner.tsx b/client/src/components/push-prompt-banner.tsx index 621c59a..1abbd75 100644 --- a/client/src/components/push-prompt-banner.tsx +++ b/client/src/components/push-prompt-banner.tsx @@ -5,6 +5,7 @@ import { useToast } from "@/hooks/use-toast"; import { isPushSupported, getExistingSubscription, subscribeToPush } from "@/lib/push-utils"; const DISMISS_KEY = "folx-push-prompt-dismissed"; +const DISMISS_DAYS = 7; export default function PushPromptBanner() { const [visible, setVisible] = useState(false); @@ -12,9 +13,14 @@ export default function PushPromptBanner() { useEffect(() => { if (!isPushSupported()) return; - if (localStorage.getItem(DISMISS_KEY)) return; if (Notification.permission === "denied") return; + const dismissedAt = localStorage.getItem(DISMISS_KEY); + if (dismissedAt) { + const elapsed = Date.now() - parseInt(dismissedAt, 10); + if (elapsed < DISMISS_DAYS * 24 * 60 * 60 * 1000) return; + } + const timer = setTimeout(async () => { const sub = await getExistingSubscription(); if (!sub) setVisible(true); @@ -25,7 +31,7 @@ export default function PushPromptBanner() { const dismiss = () => { setVisible(false); - localStorage.setItem(DISMISS_KEY, "1"); + localStorage.setItem(DISMISS_KEY, Date.now().toString()); }; const accept = async () => {