import { useEffect, useRef } from 'react' import { QUICK_REACTIONS } from './CollabChat.constants' import { TwemojiImg } from './CollabChatTwemojiImg' /* ── Reaction Quick Menu (right-click) ── */ interface ReactionMenuProps { x: number y: number onReact: (emoji: string) => void onClose: () => void } export function ReactionMenu({ x, y, onReact, onClose }: ReactionMenuProps) { const ref = useRef(null) useEffect(() => { const close = (e) => { if (ref.current && !ref.current.contains(e.target)) onClose() } document.addEventListener('mousedown', close) return () => document.removeEventListener('mousedown', close) }, [onClose]) // Clamp to viewport const menuWidth = 156 const clampedLeft = Math.max(menuWidth / 2 + 8, Math.min(x, window.innerWidth - menuWidth / 2 - 8)) return (