"use client"; import type { Node } from "@xyflow/react"; interface NodeIOBadgesProps { node: Node; } export default function NodeIOBadges({ node }: NodeIOBadgesProps) { const nodeData = node.data as any; const nodeType = nodeData.nodeType; // Get output info (just show output, not input) const getOutputInfo = (): string | null => { if (nodeType === 'end') return null; if (nodeType === 'note') return null; if (nodeType === 'start') return null; // Check output mapping if (nodeData.outputMapping) { if (nodeData.outputMapping.outputAs === 'field') { return nodeData.outputMapping.fieldName; } if (nodeData.outputMapping.outputAs === 'custom') { return 'custom'; } } // Check specific field outputs if (nodeData.outputField && nodeData.outputField !== 'full') { return nodeData.outputField; } // Check for JSON schema if (nodeData.jsonOutputSchema) { try { const schema = JSON.parse(nodeData.jsonOutputSchema); if (schema.properties) { const fields = Object.keys(schema.properties); if (fields.length === 1) { return fields[0]; } if (fields.length === 2) { return fields.join(', '); } return `${fields.length} fields`; } } catch (e) { // Invalid schema } } return null; // Don't show badge if no specific output }; const outputInfo = getOutputInfo(); if (!outputInfo) return null; return (
{/* Subtle Output Indicator */}
→ {outputInfo}
); }