diff --git a/app/layout.tsx b/app/layout.tsx index 664082a..63173ff 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,6 +3,7 @@ import './globals.css' import ServiceWorkerRegistration from '@/components/ServiceWorkerRegistration' import OfflineIndicator from '@/components/OfflineIndicator' import NotificationPrompt from '@/components/NotificationPrompt' +import NotificationDebug from '@/components/NotificationDebug' import { ToastProvider } from '@/components/ToastContainer' import ErrorBoundary from '@/components/ErrorBoundary' @@ -77,6 +78,7 @@ export default function RootLayout({ + {children} diff --git a/components/NotificationDebug.tsx b/components/NotificationDebug.tsx new file mode 100644 index 0000000..788ef06 --- /dev/null +++ b/components/NotificationDebug.tsx @@ -0,0 +1,29 @@ +'use client'; + +import { useEffect, useState } from 'react'; + +export default function NotificationDebug() { + const [debug, setDebug] = useState({}); + + useEffect(() => { + const info = { + notificationSupported: 'Notification' in window, + serviceWorkerSupported: 'serviceWorker' in navigator, + pushManagerSupported: 'PushManager' in window, + permission: 'Notification' in window ? Notification.permission : 'N/A', + localStorage: typeof localStorage !== 'undefined' ? localStorage.getItem('notification-prompt-dismissed') : 'N/A', + }; + setDebug(info); + }, []); + + return ( +
+
Push Debug:
+
Notification: {debug.notificationSupported ? '✓' : '✗'}
+
ServiceWorker: {debug.serviceWorkerSupported ? '✓' : '✗'}
+
PushManager: {debug.pushManagerSupported ? '✓' : '✗'}
+
Permission: {debug.permission}
+
Dismissed: {debug.localStorage || 'No'}
+
+ ); +}