import { useState, useEffect } from "react"; import { Download, X } from "lucide-react"; import { swManager } from "../utils/serviceWorkerManager"; import "./UpdateNotification.css"; export function UpdateNotification() { const [showUpdate, setShowUpdate] = useState(false); const [isUpdating, setIsUpdating] = useState(false); useEffect(() => { swManager.onUpdate(() => { setShowUpdate(true); }); }, []); const handleUpdate = async () => { setIsUpdating(true); swManager.activateUpdate(); // Wait for the page to reload setTimeout(() => { window.location.reload(); }, 500); }; const handleDismiss = () => { setShowUpdate(false); }; if (!showUpdate) return null; return (