'use client' import { useNotificationBadge } from '@/hooks/useSocket' interface NotificationBadgeProps { className?: string showZero?: boolean maxCount?: number } export default function NotificationBadge({ className = '', showZero = false, maxCount = 99, }: NotificationBadgeProps) { const { count } = useNotificationBadge() if (count === 0 && !showZero) return null const displayCount = count > maxCount ? `${maxCount}+` : count.toString() return ( {displayCount} ) } // Dot badge (no count, just indicator) export function NotificationDot({ visible = true, className = '', }: { visible?: boolean className?: string }) { if (!visible) return null return ( ) } // Badge with icon wrapper export function IconWithBadge({ children, count, showDot = false, maxCount = 99, className = '', }: { children: React.ReactNode count?: number showDot?: boolean maxCount?: number className?: string }) { const shouldShowBadge = count !== undefined && count > 0 const shouldShowDot = showDot && !shouldShowBadge return (
{children} {shouldShowBadge && ( {count > maxCount ? `${maxCount}+` : count} )} {shouldShowDot && ( )}
) } // Hook-connected version for navigation export function NavigationNotificationBadge({ className = '' }: { className?: string }) { const { count } = useNotificationBadge() if (count === 0) return null return ( {count > 99 ? '99+' : count} ) }