import React, { useContext, useMemo } from 'react' import { GraphContext } from '@/lib/graph/flowContext' import { ArrowDownLeft, ArrowUpRight } from 'lucide-react' import { NodeHelpPopover } from '@/components/graph/NodeHelpPopover' import { getNodeType, getNodeClassificationLabel } from '@/lib/graph/nodeRegistry' type Props = { nodeId: string nodeType: string children?: React.ReactNode } export function NodeFooterEdgeIndicators({ nodeId, nodeType, children }: Props) { const ctx = useContext(GraphContext) const edges = ctx?.edges ?? [] const { inputs, outputs } = useMemo(() => { let inputs = 0 let outputs = 0 for (const e of edges) { if (e.target === nodeId) inputs += 1 if (e.source === nodeId) outputs += 1 } return { inputs, outputs } }, [edges, nodeId]) const descriptor = getNodeType(nodeType) const showInput = descriptor?.hasInput ?? false const showOutput = descriptor?.hasOutput ?? false const classificationLabel = getNodeClassificationLabel(nodeType) return (
{showInput && ( {inputs} )} {showOutput && ( {outputs} )} {children != null && ( <> {(showInput || showOutput) && |} {children} )} {classificationLabel != null && ( <> {(showInput || showOutput || children != null) && |} {classificationLabel} )}
) }