Skip to content

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

feat(flows): add canvas toolbar with zoom and panel controls

Steven Enamakelb7d145c27373
diff --git a/app/src/components/flows/canvas/EditableFlowCanvas.tsx b/app/src/components/flows/canvas/EditableFlowCanvas.tsx
index 91ecde4676..f06643deba 100644
--- a/app/src/components/flows/canvas/EditableFlowCanvas.tsx
+++ b/app/src/components/flows/canvas/EditableFlowCanvas.tsx
@@ -74,7 +74,6 @@ import { useFlowValidation } from './useFlowValidation';
const log = createDebug('app:flows:canvas:edit');
-
const NODE_TYPES = { [FLOW_NODE_TYPE]: FlowNodeComponent };
const DELETE_KEYS = ['Backspace', 'Delete'];
diff --git a/app/src/components/flows/canvas/FlowCanvas.tsx b/app/src/components/flows/canvas/FlowCanvas.tsx
index b63f94bf53..c5ba641da5 100644
--- a/app/src/components/flows/canvas/FlowCanvas.tsx
+++ b/app/src/components/flows/canvas/FlowCanvas.tsx
@@ -21,13 +21,7 @@
* non-editable render path again. Delete both it and its tests together if
* no such consumer materializes.
*/
-import {
- Background,
- BackgroundVariant,
- MiniMap,
- ReactFlow,
- type Viewport,
-} from '@xyflow/react';
+import { Background, BackgroundVariant, MiniMap, ReactFlow, type Viewport } from '@xyflow/react';
import '@xyflow/react/dist/style.css';
import { forwardRef, memo, useMemo } from 'react';
@@ -39,11 +33,11 @@ import {
type WorkflowGraphMeta,
} from '../../../lib/flows/graphAdapter';
import type { WorkflowGraph } from '../../../lib/flows/types';
+import CanvasToolbar from './CanvasToolbar';
import EditableFlowCanvas, {
type EditableFlowCanvasHandle,
type EditorSaveMeta,
} from './EditableFlowCanvas';
-import CanvasToolbar from './CanvasToolbar';
import { FLOW_FIT_VIEW_OPTIONS } from './fitView';
import './flowCanvasStyles.css';
import FlowNodeComponent from './FlowNodeComponent';
diff --git a/app/src/components/flows/canvas/NodePalette.tsx b/app/src/components/flows/canvas/NodePalette.tsx
index 49a41a08e6..8e6d2b187e 100644
--- a/app/src/components/flows/canvas/NodePalette.tsx
+++ b/app/src/components/flows/canvas/NodePalette.tsx
@@ -52,7 +52,12 @@ function NodePalette({ onAdd, variant = 'overlay' }: NodePaletteProps) {
{t('flows.palette.panelHint')}
</p>
)}
- <div className={panel ? 'flex flex-col gap-4 overflow-y-auto p-4' : 'flex flex-col gap-2 overflow-y-auto p-2'}>
+ <div
+ className={
+ panel
+ ? 'flex flex-col gap-4 overflow-y-auto p-4'
+ : 'flex flex-col gap-2 overflow-y-auto p-2'
+ }>
{NODE_GROUP_ORDER.map(group => (
<div key={group} className={panel ? 'grid grid-cols-2 gap-1.5' : 'flex flex-col gap-1'}>
<div
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 0662d7cd12..3b5a5ac388 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -4888,6 +4888,12 @@ const en: TranslationMap = {
// The palette tab is labelled "Manual" (build by hand) as the counterpart to
// the AI "Copilot" tab; the key name stays `legendTab` for the node palette.
'flows.canvas.legendTab': 'Manual',
+ 'flows.canvas.toolbar': 'Canvas controls',
+ 'flows.canvas.zoomIn': 'Zoom in',
+ 'flows.canvas.zoomOut': 'Zoom out',
+ 'flows.canvas.fitView': 'Fit to screen',
+ 'flows.canvas.openPanel': 'Open side panel',
+ 'flows.canvas.closePanel': 'Close side panel',
'flows.nodeKind.trigger': 'Trigger',
'flows.nodeKind.agent': 'Agent',
'flows.nodeKind.tool_call': 'Tool call',
@@ -4952,6 +4958,7 @@ const en: TranslationMap = {
// ── Editable Workflow Canvas (issue B5b.2 / Phase 3a): the node palette
// and editor toolbar layered on top of the read-only canvas above.
'flows.palette.title': 'Nodes',
+ 'flows.palette.panelHint': 'Click a step to add it to the canvas, or drag it where you want it.',
'flows.palette.addNode': 'Add {kind} node',
'flows.palette.search': 'Search nodes…',
'flows.palette.noResults': 'No matching nodes',
diff --git a/app/src/pages/FlowCanvasPage.tsx b/app/src/pages/FlowCanvasPage.tsx
index 62a715bfd8..651cb70c24 100644
--- a/app/src/pages/FlowCanvasPage.tsx
+++ b/app/src/pages/FlowCanvasPage.tsx
@@ -19,6 +19,7 @@
*/
import type { Viewport } from '@xyflow/react';
import createDebug from 'debug';
+import { Blocks, PanelRightClose, Sparkles } from 'lucide-react';
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
@@ -27,6 +28,7 @@ import type {
EditorSaveMeta,
} from '../components/flows/canvas/EditableFlowCanvas';
import FlowCanvas from '../components/flows/canvas/FlowCanvas';
+import NodePalette from '../components/flows/canvas/NodePalette';
import { FlowPreauthorizationOverlay } from '../components/flows/FlowPreauthorizationCard';
import FlowRunsSidebar from '../components/flows/FlowRunsSidebar';
import WorkflowCopilotPanel, {
@@ -47,6 +49,7 @@ import {
CenteredLoadingState,
ConfirmDialog,
ErrorBanner,
+ Spinner,
ToggleGroupItem,
ToggleGroupRoot,
} from '../components/ui';
@@ -1339,32 +1342,32 @@ function FlowEditor({
onAdd={entry => canvasRef.current?.addPaletteEntry(entry)}
/>
)}
- {copilotOpen && (
- <WorkflowCopilotPanel
- framed
- // Stable ('copilot') across manual open/close and build-seed
- // navigations (unaffected — those always land on a fresh
- // `FlowEditor` mount already, see `locationKey`'s doc comment).
- // Repair seeds fold in `locationKey` so a same-route "Fix with
- // agent" click (no `FlowEditor` remount) still forces a fresh
- // panel mount, resetting the once-per-mount `repairSentRef` guard
- // so the repair turn actually (re)fires (issue B22).
- key={initialCopilotSeed ? `copilot-repair-${locationKey}` : 'copilot'}
- graph={preview?.base ?? draftGraph}
- flowId={flowId}
- onProposal={handleProposal}
- onAccept={handleAcceptProposal}
- onReject={handleRejectProposal}
- repairSeed={copilotRepairSeed}
- buildSeed={initialBuildSeed}
- onBuildSeedConsumed={onBuildSeedConsumed}
- prefillSeed={initialPrefillSeed}
- onPrefillSeedConsumed={onPrefillSeedConsumed}
- seedThreadId={copilotThreadId}
- onThreadIdChange={handleCopilotThreadId}
- fullWidth={hideGraph}
- />
- )}
+ {copilotOpen && (
+ <WorkflowCopilotPanel
+ framed
+ // Stable ('copilot') across manual open/close and build-seed
+ // navigations (unaffected — those always land on a fresh
+ // `FlowEditor` mount already, see `locationKey`'s doc comment).
+ // Repair seeds fold in `locationKey` so a same-route "Fix with
+ // agent" click (no `FlowEditor` remount) still forces a fresh
+ // panel mount, resetting the once-per-mount `repairSentRef` guard
+ // so the repair turn actually (re)fires (issue B22).
+ key={initialCopilotSeed ? `copilot-repair-${locationKey}` : 'copilot'}
+ graph={preview?.base ?? draftGraph}
+ flowId={flowId}
+ onProposal={handleProposal}
+ onAccept={handleAcceptProposal}
+ onReject={handleRejectProposal}
+ repairSeed={copilotRepairSeed}
+ buildSeed={initialBuildSeed}
+ onBuildSeedConsumed={onBuildSeedConsumed}
+ prefillSeed={initialPrefillSeed}
+ onPrefillSeedConsumed={onPrefillSeedConsumed}
+ seedThreadId={copilotThreadId}
+ onThreadIdChange={handleCopilotThreadId}
+ fullWidth={hideGraph}
+ />
+ )}
</div>
</section>
)}