Skip to content

Commit 55bf77f

Browse files
committed
refactor(web): streamline action bar logic in WorkflowCanvas component for improved readability
1 parent 135f15c commit 55bf77f

1 file changed

Lines changed: 28 additions & 34 deletions

File tree

apps/web/src/components/workflow/workflow-canvas.tsx

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -404,43 +404,37 @@ export function WorkflowCanvas({
404404
)}
405405

406406
{/* Main Action Bar */}
407-
{!readonly &&
408-
(onAction ||
409-
onDeploy ||
410-
onToggleExpandedOutputs ||
411-
onToggleSidebar) && (
412-
<div className="absolute top-4 right-4 flex items-center rounded-lg shadow-lg bg-background z-50 overflow-hidden">
413-
{onAction && (
414-
<ActionButton
415-
onClick={onAction}
416-
workflowStatus={workflowStatus}
417-
disabled={nodes.length === 0}
418-
/>
419-
)}
407+
{((!readonly && (onAction || onDeploy || onToggleExpandedOutputs)) ||
408+
onToggleSidebar) && (
409+
<div className="absolute top-4 right-4 flex items-center rounded-lg shadow-lg bg-background z-50 overflow-hidden">
410+
{!readonly && onAction && (
411+
<ActionButton
412+
onClick={onAction}
413+
workflowStatus={workflowStatus}
414+
disabled={nodes.length === 0}
415+
/>
416+
)}
420417

421-
{onToggleExpandedOutputs && (
422-
<OutputsToggle
423-
onClick={onToggleExpandedOutputs}
424-
expandedOutputs={expandedOutputs}
425-
disabled={!hasAnyOutputs}
426-
/>
427-
)}
418+
{!readonly && onToggleExpandedOutputs && (
419+
<OutputsToggle
420+
onClick={onToggleExpandedOutputs}
421+
expandedOutputs={expandedOutputs}
422+
disabled={!hasAnyOutputs}
423+
/>
424+
)}
428425

429-
{onDeploy && (
430-
<DeployButton
431-
onClick={onDeploy}
432-
disabled={nodes.length === 0}
433-
/>
434-
)}
426+
{!readonly && onDeploy && (
427+
<DeployButton onClick={onDeploy} disabled={nodes.length === 0} />
428+
)}
435429

436-
{onToggleSidebar && isSidebarVisible !== undefined && (
437-
<SidebarToggle
438-
onClick={onToggleSidebar}
439-
isSidebarVisible={isSidebarVisible}
440-
/>
441-
)}
442-
</div>
443-
)}
430+
{onToggleSidebar && isSidebarVisible !== undefined && (
431+
<SidebarToggle
432+
onClick={onToggleSidebar}
433+
isSidebarVisible={isSidebarVisible}
434+
/>
435+
)}
436+
</div>
437+
)}
444438

445439
{onAddNode && !readonly && (
446440
<CanvasButton

0 commit comments

Comments
 (0)