All files / src/components/WorkflowBuilder/nodes ParallelNode.tsx

0% Statements 0/30
0% Branches 0/1
0% Functions 0/1
0% Lines 0/30

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                                                                                                               
/**
 * Parallel Node Component
 *
 * Node for parallel execution of steps.
 */
 
import { memo } from 'react';
import { Handle, Position, NodeProps, Node } from '@xyflow/react';
import type { ParallelNodeData } from '../../../lib/workflow-builder/types';
 
export const ParallelNode = memo(({ data, selected }: NodeProps<Node<ParallelNodeData>>) => {
  return (
    <div
      className={`
        px-4 py-3 rounded-lg border-2 min-w-[180px]
        bg-cyan-50 border-cyan-300
        ${selected ? 'border-cyan-500 shadow-lg shadow-cyan-200' : ''}
      `}
    >
      {/* Input Handle */}
      <Handle
        type="target"
        position={Position.Left}
        className="w-3 h-3 bg-cyan-400 border-2 border-white"
      />
 
      {/* Output Handle */}
      <Handle
        type="source"
        position={Position.Right}
        className="w-3 h-3 bg-cyan-500 border-2 border-white"
      />
 
      {/* Header */}
      <div className="flex items-center gap-2 mb-2">
        <span className="text-lg">⚡</span>
        <span className="font-medium text-cyan-800">{data.label}</span>
      </div>
 
      {/* Each Expression */}
      <div className="text-sm text-cyan-600 bg-cyan-100 rounded px-2 py-1 font-mono">
        each: {data.each || '${inputs.items}'}
      </div>
 
      {/* Max Workers */}
      <div className="text-xs text-cyan-500 mt-2">
        Max workers: {data.maxWorkers}
      </div>
    </div>
  );
});
 
ParallelNode.displayName = 'ParallelNode';
 
export default ParallelNode;