Skip to content

Commit 09307c5

Browse files
committed
1652 client - Refactor WorkflowNodeDetailsPanel to be open when the cluster element editor is open
1 parent f7b29ec commit 09307c5

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

client/src/pages/platform/workflow-editor/WorkflowEditorLayout.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -177,37 +177,37 @@ const WorkflowEditorLayout = ({includeComponents, runDisabled, showWorkflowInput
177177
<DialogContent className="absolute bottom-4 left-16 top-12 h-[calc(100vh-64px)] w-[calc(100vw-80px)] max-w-none translate-x-0 translate-y-0 gap-2 bg-surface-main p-0">
178178
<ClusterElementsWorkflowEditor />
179179

180-
{currentComponent && (
181-
<>
182-
<WorkflowNodeDetailsPanel
183-
className="fixed inset-y-0 right-0 rounded-l-none border-none"
184-
invalidateWorkflowQueries={invalidateWorkflowQueries!}
185-
previousComponentDefinitions={previousComponentDefinitions}
186-
updateWorkflowMutation={updateWorkflowMutation!}
187-
workflowNodeOutputs={filteredWorkflowNodeOutputs ?? []}
188-
/>
180+
<>
181+
<WorkflowNodeDetailsPanel
182+
className="fixed inset-y-0 right-0 rounded-l-none"
183+
closeButton={
184+
<DialogClose asChild>
185+
<Button
186+
className="absolute right-2 top-2"
187+
size="icon"
188+
title="Close the canvas"
189+
variant="ghost"
190+
>
191+
<XIcon />
192+
</Button>
193+
</DialogClose>
194+
}
195+
invalidateWorkflowQueries={invalidateWorkflowQueries!}
196+
previousComponentDefinitions={previousComponentDefinitions}
197+
updateWorkflowMutation={updateWorkflowMutation!}
198+
workflowNodeOutputs={filteredWorkflowNodeOutputs ?? []}
199+
/>
189200

190-
{dataPillPanelOpen && (
191-
<Suspense fallback={<DataPillPanelSkeleton />}>
192-
<DataPillPanel
193-
className="fixed inset-y-0 right-[465px] rounded-none"
194-
previousComponentDefinitions={previousComponentDefinitions}
195-
workflowNodeOutputs={filteredWorkflowNodeOutputs ?? []}
196-
/>
197-
</Suspense>
198-
)}
199-
</>
200-
)}
201-
202-
<DialogClose asChild>
203-
<Button
204-
className="absolute right-2 top-2 size-10 border bg-white p-2 shadow-none [&_svg]:size-5"
205-
title="Close the canvas"
206-
variant="ghost"
207-
>
208-
<XIcon />
209-
</Button>
210-
</DialogClose>
201+
{dataPillPanelOpen && (
202+
<Suspense fallback={<DataPillPanelSkeleton />}>
203+
<DataPillPanel
204+
className="fixed inset-y-0 right-[465px] rounded-none"
205+
previousComponentDefinitions={previousComponentDefinitions}
206+
workflowNodeOutputs={filteredWorkflowNodeOutputs ?? []}
207+
/>
208+
</Suspense>
209+
)}
210+
</>
211211
</DialogContent>
212212
</Dialog>
213213
)}

client/src/pages/platform/workflow-editor/components/WorkflowNodeDetailsPanel.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import {
6464
import {TooltipPortal} from '@radix-ui/react-tooltip';
6565
import {useQueryClient} from '@tanstack/react-query';
6666
import {InfoIcon, XIcon} from 'lucide-react';
67-
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
67+
import {ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';
6868
import isEqual from 'react-fast-compare';
6969
import InlineSVG from 'react-inlinesvg';
7070
import {twMerge} from 'tailwind-merge';
@@ -106,6 +106,7 @@ const TABS: Array<{label: string; name: TabNameType}> = [
106106

107107
interface WorkflowNodeDetailsPanelProps {
108108
className?: string;
109+
closeButton?: ReactNode;
109110
invalidateWorkflowQueries: () => void;
110111
previousComponentDefinitions: Array<ComponentDefinitionBasic>;
111112
updateWorkflowMutation: UpdateWorkflowMutationType;
@@ -114,6 +115,7 @@ interface WorkflowNodeDetailsPanelProps {
114115

115116
const WorkflowNodeDetailsPanel = ({
116117
className,
118+
closeButton,
117119
invalidateWorkflowQueries,
118120
previousComponentDefinitions,
119121
updateWorkflowMutation,
@@ -1155,13 +1157,17 @@ const WorkflowNodeDetailsPanel = ({
11551157
</Tooltip>
11561158
)}
11571159

1158-
<button
1159-
aria-label="Close the node details dialog"
1160-
className="ml-auto pr-0"
1161-
onClick={handlePanelClose}
1162-
>
1163-
<XIcon aria-hidden="true" className="size-4 cursor-pointer" />
1164-
</button>
1160+
{closeButton ? (
1161+
closeButton
1162+
) : (
1163+
<button
1164+
aria-label="Close the node details dialog"
1165+
className="ml-auto pr-0"
1166+
onClick={handlePanelClose}
1167+
>
1168+
<XIcon aria-hidden="true" className="size-4 cursor-pointer" />
1169+
</button>
1170+
)}
11651171
</header>
11661172

11671173
<main className="flex h-full flex-col overflow-hidden">

client/src/pages/platform/workflow-editor/hooks/useNodeClick.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ export default function useNodeClick(data: NodeDataType, id: NodeProps['id'], ac
5353

5454
if (!!data.clusterRoot && !clusterElementsCanvasOpen) {
5555
setClusterElementsCanvasOpen(true);
56-
57-
setCurrentComponent(undefined);
58-
59-
setWorkflowNodeDetailsPanelOpen(false);
60-
61-
return;
6256
}
6357

6458
setWorkflowNodeDetailsPanelOpen(true);

0 commit comments

Comments
 (0)