import { Copy, Braces, Pencil, CircleSlash, Link2, Eye, MousePointerClick } from "lucide-react"; interface Props { anchorRect: DOMRect; editable: boolean; isJson: boolean; isFk: boolean; nullable: boolean; /** When true, hide row-scoped actions (View Row / Select Row) — pending insert rows have no backing row. */ isInsertRow?: boolean; onCopy: () => void; onCopyJson: () => void; onEdit: () => void; onSetNull: () => void; onOpenFk: () => void; onClose: () => void; onViewRow: () => void; onSelectRow: () => void; } export function CellContextMenu({ anchorRect, editable, isJson, isFk, nullable, isInsertRow = false, onCopy, onCopyJson, onEdit, onSetNull, onOpenFk, onClose, onViewRow, onSelectRow }: Props) { const items: { label: string; icon: React.ReactNode; onClick: () => void; show: boolean }[] = [ { label: "Copy", icon: , onClick: () => { onCopy(); onClose(); }, show: true }, { label: "Copy JSON", icon: , onClick: () => { onCopyJson(); onClose(); }, show: isJson }, { label: "View Row", icon: , onClick: () => { onViewRow(); onClose(); }, show: !isInsertRow }, { label: "Select Row", icon: , onClick: () => { onSelectRow(); onClose(); }, show: !isInsertRow }, { label: "Edit", icon: , onClick: () => { onEdit(); onClose(); }, show: editable }, { label: "Set NULL", icon: , onClick: () => { onSetNull(); onClose(); }, show: editable && nullable }, { label: "Open FK reference", icon: , onClick: () => { onOpenFk(); onClose(); }, show: isFk }, ]; return (
e.stopPropagation()} > {items.filter((i) => i.show).map((i) => ( ))}
); }