Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(flows): update flow node component

Steven Enamakeld94f27bb8fc1
diff --git a/app/src/components/flows/canvas/FlowNodeComponent.tsx b/app/src/components/flows/canvas/FlowNodeComponent.tsx
index a222dccbd0..1ffa4358ab 100644
--- a/app/src/components/flows/canvas/FlowNodeComponent.tsx
+++ b/app/src/components/flows/canvas/FlowNodeComponent.tsx
@@ -135,16 +135,40 @@ function FlowNodeComponent({ id, data, selected }: NodeProps<FlowNode>) {
<div
data-testid="flow-node"
data-node-kind={data.kind}
- className={`relative w-[264px] rounded-xl border bg-surface shadow-[0_1px_2px_rgba(0,0,0,0.06),0_4px_12px_rgba(0,0,0,0.08)] transition-all duration-150 dark:shadow-[0_2px_6px_rgba(0,0,0,0.5),0_8px_24px_rgba(0,0,0,0.45)] ${
+ className={`relative w-[264px] rounded-2xl border bg-surface shadow-[0_1px_2px_rgba(0,0,0,0.06),0_4px_12px_rgba(0,0,0,0.08)] transition-all duration-150 dark:shadow-[0_2px_6px_rgba(0,0,0,0.5),0_8px_24px_rgba(0,0,0,0.45)] ${
selected
? 'border-primary-500 ring-2 ring-primary-500/40'
: 'border-line-strong hover:-translate-y-px hover:border-primary-500/40 hover:shadow-[0_2px_4px_rgba(0,0,0,0.08),0_10px_28px_rgba(0,0,0,0.12)] dark:hover:shadow-[0_4px_10px_rgba(0,0,0,0.55),0_14px_36px_rgba(0,0,0,0.5)]'
}`}>
+ {/* Inputs — dots straddling the TOP edge, each label (when there is one)
+ stacked above its own dot and outside the card, where it cannot
+ overlap the title band. `-translate-y-1/2` centres the dot on the
+ border rather than resting it against the inside. */}
+ {data.inputPorts.length > 0 && (
+ <div
+ className="absolute inset-x-0 top-0 flex -translate-y-1/2 items-end justify-center gap-4"
+ data-testid="flow-node-inputs">
+ {data.inputPorts.map(port => (
+ <div key={`in-${port}`} className="flex flex-col items-center gap-1">
+ {labelInputs && <span className={portPillClass(port)}>{port}</span>}
+ <Handle
+ id={port}
+ type="target"
+ position={Position.Top}
+ style={INLINE_HANDLE_STYLE}
+ className={HANDLE_CLASS}
+ title={port}
+ />
+ </div>
+ ))}
+ </div>
+ )}
+
{/* Title band — the card's only secondary fill. Everything below the
divider shares the card's own `bg-surface`, so the body reads as one
uninterrupted surface: a separately-tinted summary well plus an
untinted connector row gave the card three competing bands. */}
- <div className="flex items-center gap-3 rounded-t-xl border-b border-line-strong/60 bg-surface-muted px-3 py-2.5">
+ <div className="flex items-center gap-3 rounded-t-2xl border-b border-line-strong/60 bg-surface-muted px-3 py-2.5">
{/* Kind glyph on a saturated tile — the card's only filled colour.
Status stays legible because it is drawn as a ring around the whole
card, so identity (filled square) and state (outline) never share
@@ -187,42 +211,6 @@ function FlowNodeComponent({ id, data, selected }: NodeProps<FlowNode>) {
</div>
)}
- {hasPorts && (
- <div className="flex items-start justify-between gap-4 px-2 py-2">
- {/* Inputs — handle on the left edge, label to its right. */}
- <div className="flex min-w-0 flex-col gap-1.5">
- {data.inputPorts.map(port => (
- <div key={`in-${port}`} className="flex items-center gap-1.5">
- <Handle
- id={port}
- type="target"
- position={Position.Left}
- style={INLINE_HANDLE_STYLE}
- title={port}
- />
- {labelInputs && <span className={`truncate ${portPillClass(port)}`}>{port}</span>}
- </div>
- ))}
- </div>
-
- {/* Outputs — label first, handle on the right edge. */}
- <div className="flex min-w-0 flex-col items-end gap-1.5">
- {data.outputPorts.map(port => (
- <div key={`out-${port}`} className="flex items-center gap-1.5">
- {labelOutputs && <span className={`truncate ${portPillClass(port)}`}>{port}</span>}
- <Handle
- id={port}
- type="source"
- position={Position.Right}
- style={INLINE_HANDLE_STYLE}
- title={port}
- />
- </div>
- ))}
- </div>
- </div>
- )}
-
{/* Per-node actions on the selected card (editable canvas only). */}
{showActions && actions && (
<div className="flex items-center justify-end gap-1 border-t border-line px-2 py-1.5">
@@ -248,6 +236,30 @@ function FlowNodeComponent({ id, data, selected }: NodeProps<FlowNode>) {
</Button>
</div>
)}
+
+ {/* Outputs — dots straddling the BOTTOM edge, labels below them. This is
+ where the labelled case actually lands in practice: a `condition`'s
+ `true` / `false` sit under their own outgoing dots, so which branch a
+ given edge leaves by is readable without tracing it. */}
+ {data.outputPorts.length > 0 && (
+ <div
+ className="absolute inset-x-0 bottom-0 flex translate-y-1/2 items-start justify-center gap-4"
+ data-testid="flow-node-outputs">
+ {data.outputPorts.map(port => (
+ <div key={`out-${port}`} className="flex flex-col items-center gap-1">
+ <Handle
+ id={port}
+ type="source"
+ position={Position.Bottom}
+ style={INLINE_HANDLE_STYLE}
+ className={HANDLE_CLASS}
+ title={port}
+ />
+ {labelOutputs && <span className={portPillClass(port)}>{port}</span>}
+ </div>
+ ))}
+ </div>
+ )}
</div>
);
}