'use client' import { useEffect, useState } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { RefreshCw, X, Download } from 'lucide-react' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { registerUpdateHandler, forceReload } from '@/lib/cache-manager' interface UpdateNotificationProps { autoShow?: boolean position?: 'top' | 'bottom' } export default function UpdateNotification({ autoShow = true, position = 'bottom' }: UpdateNotificationProps) { const [showUpdate, setShowUpdate] = useState(false) const [isUpdating, setIsUpdating] = useState(false) useEffect(() => { if (autoShow) { // Register for update notifications registerUpdateHandler(() => { setShowUpdate(true) }) } }, [autoShow]) const handleUpdate = async () => { setIsUpdating(true) try { // Force reload with cache clear forceReload() } catch (error) { console.error('Update failed:', error) setIsUpdating(false) } } const handleDismiss = () => { setShowUpdate(false) } const positionStyles = position === 'top' ? 'top-4 left-4 right-4' : 'bottom-4 left-4 right-4' return ( {showUpdate && (
{/* Background pattern */}
{/* Content */}

Update Available!

Version 2.0

A new version is available with improved features and bug fixes. Refresh to get the latest updates.

{/* Animated shimmer effect */}
)} ) } // Development component to manually trigger updates export function DevUpdateTrigger() { const [showUpdate, setShowUpdate] = useState(false) if (process.env.NODE_ENV !== 'development') { return null } return (
{showUpdate && ( )}
) }