'use client'; import { useState, useEffect } from 'react'; import { RefreshCw } from 'lucide-react'; interface UpdateNotificationProps { registration: ServiceWorkerRegistration | null; } export function UpdateNotification({ registration }: UpdateNotificationProps) { const [showNotification, setShowNotification] = useState(false); useEffect(() => { if (registration) { setShowNotification(true); } }, [registration]); const handleUpdate = () => { if (registration && registration.waiting) { // Tell the service worker to skip waiting registration.waiting.postMessage({ type: 'SKIP_WAITING' }); // Listen for the controller change and reload navigator.serviceWorker.addEventListener('controllerchange', () => { window.location.reload(); }); } }; const handleDismiss = () => { setShowNotification(false); }; if (!showNotification) { return null; } return (

New version available!

A new version of Puffin Offset is ready. Please update to get the latest features and improvements.

); }