import { type JSX, memo, useCallback, useState } from 'react'; import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/components/ui/tooltip'; import { MessageSquare } from 'lucide-react'; interface UnreadCommentsBadgeProps { unreadCount: number; totalCount: number; pulseKey?: number; } export const UnreadCommentsBadge = memo(function UnreadCommentsBadge({ unreadCount, totalCount, pulseKey, }: UnreadCommentsBadgeProps): JSX.Element | null { const [open, setOpen] = useState(false); const handleOpenChange = useCallback((nextOpen: boolean) => { setOpen(nextOpen); }, []); if (totalCount === 0) return null; const shouldPulse = (pulseKey ?? 0) > 0; return ( {totalCount} {unreadCount > 0 ? ( {unreadCount} ) : null} {open ? ( {unreadCount > 0 ? `${unreadCount} unread comments, ${totalCount} total` : `${totalCount} comments`} ) : null} ); });