Skip to content

Commit 278a3de

Browse files
committed
improvement(docs): simplify expanded workflows to an interactive canvas
1 parent 784c5fc commit 278a3de

9 files changed

Lines changed: 33 additions & 378 deletions

File tree

‎apps/docs/DESIGN_SYSTEM.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Disclosures use a 16px chevron, 8px label gap, a 38px desktop summary (44px touc
6969
| Open navigation rows | `components/ui/cards.tsx` |
7070
| CLI command grids | `components/ui/command-table.tsx` |
7171
| Canonical provider marks | `components/ui/integration-icon.tsx` |
72-
| Original workflow graph/configuration | `components/workflow-preview/workflow-preview.tsx`, `block-inspector.tsx` |
72+
| Original workflow graph | `components/workflow-preview/workflow-preview.tsx` |
7373
| Complete nested workflow results, copy, download | `components/workflow-preview/output-bundle.tsx` |
7474
| Real component/state gallery | `components/docs/gallery.tsx` |
7575

‎apps/docs/components/workflow-preview/block-inspector.tsx‎

Lines changed: 0 additions & 190 deletions
This file was deleted.

‎apps/docs/components/workflow-preview/docs-block-node.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const DocsBlockNode = memo(function DocsBlockNode({
5757
id,
5858
data,
5959
}: NodeProps<DocsBlockNodeType>) {
60-
const { selectBlock, renderDetails } = useContext(PreviewSelectionContext)
60+
const selectBlock = useContext(PreviewSelectionContext)
6161
const {
6262
name,
6363
blockType,
@@ -181,7 +181,6 @@ export const DocsBlockNode = memo(function DocsBlockNode({
181181
}
182182
rows={rows}
183183
/>
184-
{renderDetails(id)}
185184
</m.div>
186185
)
187186
})

‎apps/docs/components/workflow-preview/docs-container-node.tsx‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ export const DocsContainerNode = memo(function DocsContainerNode({
2727
id,
2828
data,
2929
}: NodeProps<DocsContainerNodeType>) {
30-
const { selectBlock, renderDetails } = useContext(PreviewSelectionContext)
31-
const details = renderDetails(id)
30+
const selectBlock = useContext(PreviewSelectionContext)
3231
const subflowData: SubflowNodeData = {
3332
kind: data.blockType === 'parallel' ? 'parallel' : 'loop',
3433
name: data.name,
@@ -40,7 +39,7 @@ export const DocsContainerNode = memo(function DocsContainerNode({
4039
}
4140

4241
return (
43-
<div className={cn('relative size-full', data.isDimmed && DIMMED_PREVIEW_CLASS)}>
42+
<div className={cn('size-full', data.isDimmed && DIMMED_PREVIEW_CLASS)}>
4443
<SubflowNodeView
4544
id={id}
4645
data={subflowData}
@@ -49,11 +48,8 @@ export const DocsContainerNode = memo(function DocsContainerNode({
4948
isFocused={false}
5049
nestingLevel={0}
5150
canEditWorkflow={false}
52-
onSelect={() => selectBlock?.(id)}
51+
onSelect={selectBlock ? () => selectBlock(id) : undefined}
5352
/>
54-
{details && (
55-
<div className='absolute inset-x-3 top-12 bottom-3 z-10 overflow-y-auto'>{details}</div>
56-
)}
5753
</div>
5854
)
5955
})
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
'use client'
22

3-
import { createContext, type ReactNode } from 'react'
3+
import { createContext } from 'react'
44

5-
interface PreviewSelection {
6-
selectBlock?: (blockId: string) => void
7-
renderDetails: (blockId: string) => ReactNode
8-
}
9-
10-
export const PreviewSelectionContext = createContext<PreviewSelection>({
11-
renderDetails: () => null,
12-
})
5+
export const PreviewSelectionContext = createContext<((blockId: string) => void) | undefined>(
6+
undefined
7+
)

‎apps/docs/components/workflow-preview/workflow-data.ts‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ export const DIMMED_PREVIEW_CLASS =
9090
export interface HighlightOptions {
9191
highlightBlock?: string
9292
highlightEdge?: string
93-
/** Ring one block (selection) without dimming the rest. */
94-
selectedBlock?: string
9593
}
9694

9795
/** Semantic container depth used for z-order while docs positions stay flattened. */
@@ -124,7 +122,7 @@ export function toReactFlowElements(
124122
animate = false,
125123
highlight: HighlightOptions = {}
126124
): { nodes: PreviewNode[]; edges: PreviewFlowEdge[] } {
127-
const { highlightBlock, highlightEdge, selectedBlock } = highlight
125+
const { highlightBlock, highlightEdge } = highlight
128126
const hasHighlight = Boolean(highlightBlock || highlightEdge)
129127
const blockIndexMap = new Map(workflow.blocks.map((b, i) => [b.id, i]))
130128

@@ -146,14 +144,7 @@ export function toReactFlowElements(
146144
const commonNode = {
147145
id: block.id,
148146
position,
149-
zIndex:
150-
selectedBlock === block.id
151-
? CONTAINER_CHILD_Z_BASE + 10
152-
: isContainer
153-
? nestingDepth
154-
: block.parentId
155-
? CONTAINER_CHILD_Z_BASE
156-
: BLOCK_Z_BASE,
147+
zIndex: isContainer ? nestingDepth : block.parentId ? CONTAINER_CHILD_Z_BASE : BLOCK_Z_BASE,
157148
...(block.size ? { style: { width: block.size.width, height: block.size.height } } : {}),
158149
draggable: true,
159150
selectable: false,
@@ -175,8 +166,8 @@ export function toReactFlowElements(
175166
parentId: block.parentId,
176167
index,
177168
animate,
178-
isHighlighted: highlightBlock === block.id || selectedBlock === block.id,
179-
isDimmed: hasHighlight && highlightBlock !== block.id && selectedBlock !== block.id,
169+
isHighlighted: highlightBlock === block.id,
170+
isDimmed: hasHighlight && highlightBlock !== block.id,
180171
}
181172
return {
182173
...commonNode,
@@ -202,8 +193,8 @@ export function toReactFlowElements(
202193
parentId: block.parentId,
203194
index,
204195
animate,
205-
isHighlighted: highlightBlock === block.id || selectedBlock === block.id,
206-
isDimmed: hasHighlight && highlightBlock !== block.id && selectedBlock !== block.id,
196+
isHighlighted: highlightBlock === block.id,
197+
isDimmed: hasHighlight && highlightBlock !== block.id,
207198
}
208199
return {
209200
...commonNode,

0 commit comments

Comments
 (0)