import React, { memo } from 'react'; import Link from 'next/link'; import { Bell } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; import { useNotifications } from '@/hooks/use-notifications'; interface NotificationBadgeProps { className?: string; } // Use React.memo to prevent unnecessary re-renders export const NotificationBadge = memo(function NotificationBadge({ className }: NotificationBadgeProps) { const { notificationCount } = useNotifications(); const hasUnread = notificationCount.unread > 0; return (
{hasUnread && ( {notificationCount.unread > 99 ? '99+' : notificationCount.unread} )}
); });