mirror of
https://github.com/simstudioai/sim.git
synced 2026-08-31 01:11:53 +08:00
528b34f564
* fix(workflow): hide idle nested subflow end handles * perf(workflow): avoid repeated subflow edge scans * perf(workflow): stabilize subflow edge selector --------- Co-authored-by: Bill Leoutsakos <billleoutsakos@Bills-MacBook-Pro.local> Co-authored-by: Waleed Latif <walif6@gmail.com>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
'use client'
|
|
|
|
import { memo } from 'react'
|
|
import { type SubflowNodeData, SubflowNodeView } from '@sim/workflow-renderer'
|
|
import type { NodeProps } from 'reactflow'
|
|
|
|
interface DocsContainerData {
|
|
name: string
|
|
blockType: string
|
|
size?: { width: number; height: number }
|
|
parentId?: string
|
|
}
|
|
|
|
/**
|
|
* Docs adapter for loop/parallel container blocks: maps the static preview data
|
|
* to {@link SubflowNodeView}'s read-only `isPreview` shape. Carries no stores,
|
|
* hooks, or queries — it only reshapes data into View props.
|
|
*/
|
|
export const DocsContainerNode = memo(function DocsContainerNode({
|
|
id,
|
|
data,
|
|
}: NodeProps<DocsContainerData>) {
|
|
const subflowData: SubflowNodeData = {
|
|
kind: data.blockType === 'parallel' ? 'parallel' : 'loop',
|
|
name: data.name,
|
|
width: data.size?.width,
|
|
height: data.size?.height,
|
|
parentId: data.parentId,
|
|
isPreview: true,
|
|
}
|
|
|
|
return (
|
|
<SubflowNodeView
|
|
id={id}
|
|
data={subflowData}
|
|
isEnabled
|
|
isLocked={false}
|
|
isFocused={false}
|
|
nestingLevel={0}
|
|
canEditWorkflow={false}
|
|
onSelect={() => {}}
|
|
/>
|
|
)
|
|
})
|