Skip to content

Commit d42f5cf

Browse files
committed
add more properties
1 parent 0a56955 commit d42f5cf

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/workflow-preview/workflow-preview-block.tsx

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ interface WorkflowPreviewBlockData {
88
type: string
99
name: string
1010
isTrigger?: boolean
11+
horizontalHandles?: boolean
12+
enabled?: boolean
1113
}
1214

1315
/**
1416
* Lightweight block component for workflow previews.
15-
* Renders block header, dummy subblocks skeleton, and horizontal handles.
16-
* No hooks, store subscriptions, or interactive features.
17+
* Renders block header, dummy subblocks skeleton, and handles.
18+
* Respects horizontalHandles and enabled state from workflow.
19+
* No heavy hooks, store subscriptions, or interactive features.
1720
* Used in template cards and other preview contexts for performance.
1821
*/
1922
function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>) {
20-
const { type, name, isTrigger = false } = data
23+
const { type, name, isTrigger = false, horizontalHandles = false, enabled = true } = data
2124

2225
const blockConfig = getBlock(type)
2326
if (!blockConfig) {
@@ -44,19 +47,24 @@ function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>
4447
const hasSubBlocks = visibleSubBlocks.length > 0
4548
const showErrorRow = !isStarterOrTrigger
4649

47-
// Handle styles - always horizontal
48-
const handleClass = '!border-none !bg-[var(--surface-12)] !h-5 !w-[7px] !rounded-[2px]'
50+
// Handle styles based on orientation
51+
const horizontalHandleClass = '!border-none !bg-[var(--surface-12)] !h-5 !w-[7px] !rounded-[2px]'
52+
const verticalHandleClass = '!border-none !bg-[var(--surface-12)] !h-[7px] !w-5 !rounded-[2px]'
4953

5054
return (
5155
<div className='relative w-[250px] select-none rounded-[8px] border border-[var(--border)] bg-[var(--surface-2)]'>
5256
{/* Target handle - not shown for triggers/starters */}
5357
{!isStarterOrTrigger && (
5458
<Handle
5559
type='target'
56-
position={Position.Left}
60+
position={horizontalHandles ? Position.Left : Position.Top}
5761
id='target'
58-
className={handleClass}
59-
style={{ left: '-7px', top: '24px' }}
62+
className={horizontalHandles ? horizontalHandleClass : verticalHandleClass}
63+
style={
64+
horizontalHandles
65+
? { left: '-7px', top: '24px' }
66+
: { top: '-7px', left: '50%', transform: 'translateX(-50%)' }
67+
}
6068
/>
6169
)}
6270

@@ -66,11 +74,14 @@ function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>
6674
>
6775
<div
6876
className='flex h-[24px] w-[24px] flex-shrink-0 items-center justify-center rounded-[6px]'
69-
style={{ background: blockConfig.bgColor }}
77+
style={{ background: enabled ? blockConfig.bgColor : 'gray' }}
7078
>
7179
<IconComponent className='h-[16px] w-[16px] text-white' />
7280
</div>
73-
<span className='truncate font-medium text-[16px]' title={name}>
81+
<span
82+
className={`truncate font-medium text-[16px] ${!enabled ? 'text-[#808080]' : ''}`}
83+
title={name}
84+
>
7485
{name}
7586
</span>
7687
</div>
@@ -106,10 +117,14 @@ function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>
106117
{/* Source handle */}
107118
<Handle
108119
type='source'
109-
position={Position.Right}
120+
position={horizontalHandles ? Position.Right : Position.Bottom}
110121
id='source'
111-
className={handleClass}
112-
style={{ right: '-7px', top: '24px' }}
122+
className={horizontalHandles ? horizontalHandleClass : verticalHandleClass}
123+
style={
124+
horizontalHandles
125+
? { right: '-7px', top: '24px' }
126+
: { bottom: '-7px', left: '50%', transform: 'translateX(-50%)' }
127+
}
113128
/>
114129
</div>
115130
)

apps/sim/app/workspace/[workspaceId]/w/components/workflow-preview/workflow-preview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export function WorkflowPreview({
177177
type: block.type,
178178
name: block.name,
179179
isTrigger: block.triggerMode === true,
180+
horizontalHandles: block.horizontalHandles ?? false,
181+
enabled: block.enabled ?? true,
180182
},
181183
})
182184
return

0 commit comments

Comments
 (0)