import { useState, useRef } from 'react' import ReactDOM from 'react-dom' import { TwemojiImg } from './CollabChatTwemojiImg' import type { ChatReaction } from './CollabChat.types' /* ── Reaction Badge with NOMAD tooltip ── */ interface ReactionBadgeProps { reaction: ChatReaction currentUserId: number onReact: () => void } export function ReactionBadge({ reaction, currentUserId, onReact }: ReactionBadgeProps) { const [hover, setHover] = useState(false) const [pos, setPos] = useState({ top: 0, left: 0 }) const ref = useRef(null) const names = reaction.users.map(u => u.username).join(', ') return ( <> {hover && names && ReactDOM.createPortal(