function applyConfig()

in visual/react/app/page.tsx [29:66]


function applyConfig({ nodes, edges }: { nodes: Node[], edges: Edge[] }): { layoutNodes: Node[], layoutEdges: Edge[] } {
  let isParent = new Set<string>();
  nodes.forEach((node: Node) => {
    if (node.parentId) {
      isParent.add(node.parentId);
    }
  })
  return {
    layoutNodes: nodes.map((node: Node) => {
      return {
        className: 'px-2 py-0.5 bg-white rounded-lg shadow-lg border-solid border-neutral-200 border-1' + ' ' + (
          isParent.has(node.id) ?
            // Step
            '' :
            // SubFlow
            'max-w-xs'
        ),
        deletable: false,
        connectable: false,
        extent: node.parentId ? 'parent' : undefined,
        type: isParent.has(node.id) ? 'SubFlow' : 'Step',
        expandParent: true, // TODO: remove
        targetPosition: Position.Left,
        sourcePosition: Position.Right,
        ...node,
      }
    }),
    layoutEdges: edges.map((edge: Edge) => {
      return {
        animated: true,
        deletable: false,
        focusable: false,
        markerEnd: { type: MarkerType.ArrowClosed },
        ...edge,
      }
    }),
  }
}