My-Weekly-ToDo-List/src/app/providers.tsx
mARTin f9c7893341 feat: add push notifications for calendar event reminders
- Service worker + Web Push API for browser/mobile notifications
- PWA manifest with icons for home screen install (iOS 16.4+)
- Push subscription management (subscribe/unsubscribe API routes)
- Notification toggle in Settings > General
- Push scheduler script (cron) checks cached events and sends
  notifications at reminder times, with dedup tracking
- Test notification endpoint at /api/push/test
- Persists reminders in calendar event cache for scheduler access
- New DB models: PushSubscription, SentNotification
- New user field: notificationsEnabled

Setup: generate VAPID keys with `npx tsx scripts/generate-vapid-keys.ts`
and add to .env, then run scheduler via cron every minute.

v1.37.0
2026-03-16 21:38:15 +01:00

17 lines
506 B
TypeScript

'use client';
import { useEffect } from 'react';
import { SessionProvider } from 'next-auth/react';
export function Providers({ children }: { children: React.ReactNode }) {
useEffect(() => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').catch((err) => {
console.error('[SW] Registration failed:', err);
});
}
}, []);
return <SessionProvider refetchOnWindowFocus={false}>{children}</SessionProvider>;
}