'use client'; import { useState } from 'react'; import { Bell } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useNotificationHub } from '@/lib/hooks/useNotificationHub'; import { Badge } from '@/components/ui/badge'; export function NotificationPopover() { const { notifications, connectionState, clearNotifications, isConnected } = useNotificationHub(); const [isOpen, setIsOpen] = useState(false); const unreadCount = notifications.length; return (
{isOpen && (

Notifications

{unreadCount > 0 && ( )}
{notifications.length === 0 ? (

No notifications

) : (
{notifications.map((notification, index) => (

{notification.message}

{new Date(notification.timestamp).toLocaleString()}

))}
)}
{connectionState === 'connected' && 'Connected'} {connectionState === 'connecting' && 'Connecting...'} {connectionState === 'reconnecting' && 'Reconnecting...'} {connectionState === 'disconnected' && 'Disconnected'}
)}
); }