Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Refactoring workflow builder to use React Flow #1488

Merged
merged 124 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
81e03b0
feat:nw basic react workflow builder
rajesh-jonnalagadda Jul 29, 2024
78e69b2
reverted back to oiginal
rajesh-jonnalagadda Jul 29, 2024
d3e70ab
Merge pull request #1 from rajeshj11/basic-react-worflow-temp
Bhavyajain21 Jul 29, 2024
364a656
refactor:use store to isolatet the operations for workflow flow build…
rajesh-jonnalagadda Jul 31, 2024
3101734
Merge branch 'main' into feat/workflow-enhance
talboren Aug 1, 2024
f0e4b0a
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 1, 2024
6054f8a
refactor:usiign store for handling the basic operation like add dupli…
rajesh-jonnalagadda Aug 1, 2024
6ed993e
chore:clean up
rajesh-jonnalagadda Aug 1, 2024
7ec193f
Merge pull request #2 from rajeshj11/basic-react-worflow-temp
Bhavyajain21 Aug 1, 2024
c939763
feat:added connection restrictions and code clean up
rajesh-jonnalagadda Aug 2, 2024
9c1e528
Merge pull request #3 from rajeshj11/basic-react-worflow-temp
rajesh-jonnalagadda Aug 3, 2024
8cde382
Merge branch 'keephq:main' into feat/workflow-enhance
Bhavyajain21 Aug 4, 2024
53e86ac
Initial UI changes
Bhavyajain21 Aug 4, 2024
21d4478
Merge pull request #4 from Bhavyajain21/feat/ui-hanges
rajesh-jonnalagadda Aug 4, 2024
c50ec95
feat: add non draggable functionality to the node.
rajesh-jonnalagadda Aug 4, 2024
84ceed2
refactor:using elkks to layout the workflow and also added auto appe…
rajesh-jonnalagadda Aug 8, 2024
6330111
Merge remote-tracking branch 'jain-main/main' into feat-1451-dev-work…
rajesh-jonnalagadda Aug 8, 2024
b9dac68
chore:refactored the flow layout structure and adjusted the toolbox …
rajesh-jonnalagadda Aug 8, 2024
fc14618
Merge pull request #5 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 8, 2024
fbbc1a1
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 8, 2024
a9f7948
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 8, 2024
a6df7d2
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 8, 2024
d4710fa
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 9, 2024
8410ebc
feat:delete foreach switch anad added the builde statu tracker
rajesh-jonnalagadda Aug 9, 2024
7198e23
Merge pull request #6 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Aug 9, 2024
c418246
feat:added recontruction of defintion from nodes data
rajesh-jonnalagadda Aug 10, 2024
c16977e
Merge pull request #7 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Aug 10, 2024
4b283c0
Fix rerendering
Bhavyajain21 Aug 10, 2024
1bab77b
Fix rerendering
Bhavyajain21 Aug 10, 2024
d4d596d
Merge pull request #8 from Bhavyajain21/feat/render-fix
rajesh-jonnalagadda Aug 10, 2024
25c3b6f
fix:discard coutn and disable fix and properties form fix
rajesh-jonnalagadda Aug 10, 2024
739fc2d
Merge branch 'feat/workflow-enhance' of github.com:Bhavyajain21/keep …
rajesh-jonnalagadda Aug 10, 2024
7fba7ca
Merge pull request #9 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Aug 10, 2024
f2eed7c
fix:globaleditor form issue is handled
rajesh-jonnalagadda Aug 10, 2024
1bf0f2b
Merge pull request #10 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Aug 10, 2024
f6dab20
Remove console logs
Bhavyajain21 Aug 10, 2024
6ce3092
remove console logs
Bhavyajain21 Aug 10, 2024
a1c078f
Merge branch 'feat/workflow-enhance' into feat/render-fix
rajesh-jonnalagadda Aug 10, 2024
e74efd0
Merge pull request #11 from Bhavyajain21/feat/render-fix
rajesh-jonnalagadda Aug 10, 2024
22eaff0
chore:minor refactoring
rajesh-jonnalagadda Aug 10, 2024
3d565c7
Merge pull request #12 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 10, 2024
c3a185a
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 11, 2024
37a0cb2
fix: end node naming and minor form fixes
rajesh-jonnalagadda Aug 11, 2024
cdfa2bf
Remove save and discard and remove toggle to old flow
Bhavyajain21 Aug 11, 2024
64a549b
Merge pull request #14 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Aug 11, 2024
e03c523
Make form display on load
Bhavyajain21 Aug 11, 2024
71f2f4a
Merge pull request #15 from Bhavyajain21/feat/code-cleanup-old-builder
rajesh-jonnalagadda Aug 11, 2024
b042f86
fix:form initial inputs fixed
rajesh-jonnalagadda Aug 11, 2024
beb1403
fix:form opening issue
rajesh-jonnalagadda Aug 11, 2024
0c646b2
refactor: basic new editor view and minor refactoring
rajesh-jonnalagadda Aug 11, 2024
1bac454
fix:handle the empty source edge. remove edge add button for edge whe…
rajesh-jonnalagadda Aug 11, 2024
360c4a1
chore:minor style changes
rajesh-jonnalagadda Aug 11, 2024
a53c0f2
Merge pull request #16 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 11, 2024
7c81512
Merge branch 'main' into feat/workflow-enhance
shahargl Aug 12, 2024
97b10a8
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 12, 2024
b232086
feat:integrated the validations check and deploy features
rajesh-jonnalagadda Aug 12, 2024
5a012f1
Merge branch 'main' into feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
3eba476
Merge pull request #17 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
31d8764
chore:hidding the switch
rajesh-jonnalagadda Aug 12, 2024
44f060d
Merge pull request #18 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
107f240
chore:add debounce for recontruction of defintion for evry changes
rajesh-jonnalagadda Aug 12, 2024
6a85af1
Merge pull request #19 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
2114351
Merge branch 'main' into feat/workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
18b7cdd
chore:removed unwanted packages and logs
rajesh-jonnalagadda Aug 12, 2024
7470152
Merge pull request #20 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
c4c345c
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 12, 2024
0b7f891
chore:refactoring the with type checks
rajesh-jonnalagadda Aug 12, 2024
6e4eb5b
chore:define new v22 validators for new flow and handle types
rajesh-jonnalagadda Aug 12, 2024
cc097a0
chore:clean up
rajesh-jonnalagadda Aug 12, 2024
55660b2
Merge pull request #22 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 12, 2024
fcea876
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 13, 2024
27176ac
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 13, 2024
7f3e11b
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 14, 2024
5eadbb7
fix:cenetering issue and highlight the node which cause the error and…
rajesh-jonnalagadda Aug 15, 2024
fa5785b
chore:clean up and fixed the deletion flicker issue
rajesh-jonnalagadda Aug 15, 2024
5a1cead
Merge pull request #23 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Aug 15, 2024
5fc0cc3
fix:empty node plus icon centering
rajesh-jonnalagadda Aug 16, 2024
2ad7ff9
Merge pull request #24 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 16, 2024
636d919
chore:edge button updates
Bhavyajain21 Aug 16, 2024
52ae642
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 16, 2024
463f31b
chore:edge button label adjustments
Bhavyajain21 Aug 16, 2024
2015c86
chore:code format and clena up
rajesh-jonnalagadda Aug 16, 2024
1aa2e8f
Merge pull request #25 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 16, 2024
9e4dc2c
chore:cleanup the old builder
rajesh-jonnalagadda Aug 20, 2024
35e1304
Merge pull request #26 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 20, 2024
3392b43
Merge branch 'main' into feat/workflow-enhance
talboren Aug 25, 2024
6a56bb3
Merge branch 'main' into feat/workflow-enhance
talboren Aug 25, 2024
495656c
chore:fix the toolbox position issue and cleanup the sequential flow …
rajesh-jonnalagadda Aug 26, 2024
78bbb86
Merge pull request #27 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 26, 2024
ad88678
Merge branch 'main' into feat/workflow-enhance
rajesh-jonnalagadda Aug 26, 2024
6b8648d
Merge branch 'main' into feat/workflow-enhance
Matvey-Kuk Aug 26, 2024
9c5dcd3
fix:preview deployment is resolved
rajesh-jonnalagadda Aug 26, 2024
61a1bfb
Merge pull request #28 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 26, 2024
4884117
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 26, 2024
b431339
Merge branch 'main' into feat/workflow-enhance
talboren Aug 26, 2024
bcb8bdd
remove unused comments
Bhavyajain21 Aug 27, 2024
38c7c8e
Merge pull request #29 from Bhavyajain21/feat/remove-comments
Bhavyajain21 Aug 27, 2024
ce7da4c
chore:remove commented lines
rajesh-jonnalagadda Aug 27, 2024
af8580a
Merge pull request #30 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 27, 2024
79de3cc
chore:remove the sequential design flow packages from project completely
rajesh-jonnalagadda Aug 27, 2024
172ae0e
Merge pull request #31 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 27, 2024
3eea652
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 27, 2024
87a2761
feat: added trigger inputs in the flow itself.
rajesh-jonnalagadda Aug 28, 2024
5a68c38
fix: trigger input issue reoslved
rajesh-jonnalagadda Aug 28, 2024
41e9c8e
chore:remove commented code and unwanted logs
rajesh-jonnalagadda Aug 28, 2024
40557ce
Merge pull request #32 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 28, 2024
e05574e
Merge branch 'main' into feat/workflow-enhance
talboren Aug 28, 2024
136259e
chore:fix the lint issues
rajesh-jonnalagadda Aug 28, 2024
7904c12
Merge pull request #33 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 28, 2024
d6e4734
fix:fix build es lint issue
rajesh-jonnalagadda Aug 28, 2024
2e0cf2e
Merge pull request #34 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Aug 28, 2024
d7e33bc
Merge branch 'main' into feat/workflow-enhance
rajesh-jonnalagadda Aug 28, 2024
9b71a84
Merge branch 'main' into feat/workflow-enhance
talboren Aug 30, 2024
e7cb4bf
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Aug 30, 2024
6af846f
Merge branch 'main' into feat/workflow-enhance
Bhavyajain21 Sep 1, 2024
f662e58
chore:handled the golbal step validations and added toast for save an…
rajesh-jonnalagadda Sep 1, 2024
3775299
Merge pull request #35 from rajeshj11/feat-1451-dev-workflow-enhance
Bhavyajain21 Sep 1, 2024
15d0caf
chore: fix typo
rajesh-jonnalagadda Sep 1, 2024
addc77a
Merge pull request #36 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Sep 1, 2024
c86c313
chore: added divider in gloabl editor
rajesh-jonnalagadda Sep 1, 2024
a52ff53
Merge pull request #37 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Sep 1, 2024
400b7e6
Merge branch 'main' into feat/workflow-enhance
talboren Sep 1, 2024
8969b6e
fix:truncate issue
rajesh-jonnalagadda Sep 1, 2024
6f8431a
Merge pull request #38 from rajeshj11/feat-1451-dev-workflow-enhance
rajesh-jonnalagadda Sep 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions keep-ui/app/workflows/builder/BuilderChanagesTracker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react'
import useStore from './builder-store';
import { Button } from '@tremor/react';
import { reConstructWorklowToDefinition } from 'utils/reactFlow';

export default function BuilderChanagesTracker({onDefinitionChange}:{onDefinitionChange:(def: Record<string,any>) => void}) {
const {
nodes,
edges,
setEdges,
setNodes,
isLayouted,
setIsLayouted,
v2Properties,
changes,
setChanges,
lastSavedChanges,
setLastSavedChanges
} = useStore();
const handleDiscardChanges = (e: React.MouseEvent<HTMLButtonElement>) => {
if(!isLayouted) return;
setEdges(lastSavedChanges.edges || []);
setNodes(lastSavedChanges.nodes || []);
setChanges(0);
setIsLayouted(false);
}

const handleSaveChanges = (e: React.MouseEvent<HTMLButtonElement>) =>{
e.preventDefault();
e.stopPropagation();
setLastSavedChanges({nodes: nodes, edges: edges});
const value = reConstructWorklowToDefinition({nodes: nodes, edges: edges, properties: v2Properties});
onDefinitionChange(value);
setChanges(0);
}

return (
<div className='flex gap-2.5'>
<Button
onClick={handleDiscardChanges}
disabled={changes === 0}
>Discard{changes ? `(${changes})`: ""}</Button>
<Button
onClick={handleSaveChanges}
disabled={changes === 0}
>Save</Button>
</div>
)
}
124 changes: 124 additions & 0 deletions keep-ui/app/workflows/builder/CustomEdge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import React from "react";
import { BaseEdge, EdgeLabelRenderer, getSmoothStepPath } from "@xyflow/react";
import type { Edge, EdgeProps } from "@xyflow/react";
import useStore from "./builder-store";
import { PlusIcon } from "@radix-ui/react-icons";
import { Button } from "@tremor/react";
import '@xyflow/react/dist/style.css';

interface CustomEdgeProps extends EdgeProps {
label?: string;
type?: string;
data?: any;
}

const CustomEdge: React.FC<CustomEdgeProps> = ({
id,
sourceX,
sourceY,
targetX,
targetY,
label,
source,
target,
data,
style,
}: CustomEdgeProps) => {
const { deleteEdges, edges, setSelectedEdge, selectedEdge } = useStore();

// Calculate the path and midpoint
const [edgePath, labelX, labelY] = getSmoothStepPath({
sourceX,
sourceY,
targetX,
targetY,
borderRadius: 10,
});

const midpointX = (sourceX + targetX) / 2;
const midpointY = (sourceY + targetY) / 2;

let dynamicLabel = label;
const isLayouted = !!data?.isLayouted;
let showAddButton = !source?.includes('empty') && !target?.includes('trigger_end') && source !== 'start';

if (!showAddButton) {
showAddButton = target?.includes('trigger_end') && source?.includes("trigger_start");
}

const color = dynamicLabel === "True" ? "left-0 bg-green-500" : dynamicLabel === "False" ? "bg-red-500" : "bg-orange-500";
return (
<>
<BaseEdge
id={id}
path={edgePath}
style={{
opacity: isLayouted ? 1 : 0,
...style,
strokeWidth: 2,
}}

/>
<defs>
<marker
id={`arrow-${id}`}
markerWidth="15"
markerHeight="15"
refX="10"
refY="5"
orient="auto"
markerUnits="strokeWidth"
>
<path
d="M 0,0 L 10,5 L 0,10 L 3,5 Z"
fill="currentColor"
className="text-gray-500 font-extrabold" // Tailwind class for arrow color
style={{ opacity: isLayouted ? 1 : 0 }}
/>
</marker>
</defs>
<BaseEdge
id={id}
path={edgePath}
className="stroke-gray-700 stroke-2"
style={{
markerEnd: `url(#arrow-${id})`,
opacity: isLayouted ? 1 : 0
}} // Add arrowhead
/>
<EdgeLabelRenderer>
{!!dynamicLabel && (
<div
className={`absolute ${color} text-white rounded px-3 py-1 border border-gray-700`}
style={{
transform: `translate(-50%, -50%) translate(${dynamicLabel === "True" ? labelX - 45 : labelX + 48}px, ${labelY}px)`,
pointerEvents: "none",
opacity: isLayouted ? 1 : 0
}}
>
{dynamicLabel}
</div>
)}
{showAddButton && <Button
style={{
position: "absolute",
transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)`,
pointerEvents: "all",
opacity: isLayouted ? 1 : 0
}}
className={`p-0 m-0 bg-transparent text-transparent border-none`}
// tooltip="Add node"
onClick={(e) => {
setSelectedEdge(id);
}}
>
<PlusIcon
className={`size-7 hover:text-black rounded text-sm bg-white border text-gray-700 ${selectedEdge === id ? "border-2 border-orange-500" : "border-gray-700"
}`}
/> </Button>}
</EdgeLabelRenderer>
</>
);
};

export default CustomEdge;
170 changes: 170 additions & 0 deletions keep-ui/app/workflows/builder/CustomNode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import React, { memo } from "react";
import { Handle, Position } from "@xyflow/react";
import NodeMenu from "./NodeMenu";
import useStore, { FlowNode, V2Step } from "./builder-store";
import Image from "next/image";
import { GoPlus } from "react-icons/go";
import { MdNotStarted } from "react-icons/md";
import { GoSquareFill } from "react-icons/go";
import { PiDiamondsFourFill, PiSquareLogoFill } from "react-icons/pi";
import { BiSolidError } from "react-icons/bi";
import { FaHandPointer } from "react-icons/fa";
import { toast } from "react-toastify";



function IconUrlProvider(data: FlowNode["data"]) {
const { componentType, type } = data || {};
if (type === "alert" || type === "workflow" || type === "trigger" || !type) return "/keep.png";
return `/icons/${type
?.replace("step-", "")
?.replace("action-", "")
?.replace("__end", "")
?.replace("condition-", "")}-icon.png`;
}

function CustomNode({ id, data }: FlowNode) {
const { selectedNode, setSelectedNode, setOpneGlobalEditor, errorNode, synced } = useStore();
const type = data?.type
?.replace("step-", "")
?.replace("action-", "")
?.replace("condition-", "")
?.replace("__end", "")
?.replace("trigger_", "");

const isEmptyNode = !!data?.type?.includes("empty");
const specialNodeCheck = ['start', 'end', 'trigger_end', 'trigger_start'].includes(type)

function getTriggerIcon(step: any) {
const { type } = step;
switch (type) {
case "manual":
return <FaHandPointer size={32} />
case "interval":
return <PiDiamondsFourFill size={32} />
}
}

return (
<>
{!specialNodeCheck && <div
className={`p-2 flex shadow-md rounded-md bg-white border-2 w-full h-full ${id === selectedNode
? "border-orange-500"
: "border-stone-400"
}`}
onClick={(e) => {
e.stopPropagation();
if(!synced){
toast('Please save the previous step or wait while properties sync with the workflow.');
return;
}
if (type === 'start' || type === 'end' || id?.includes('end') || id?.includes('empty')) {
if (id?.includes('empty')) {
setSelectedNode(id);
}
setOpneGlobalEditor(true);
return;
}
setSelectedNode(id);
}}
style={{
opacity: data.isLayouted ? 1 : 0,
borderStyle: isEmptyNode ? 'dashed' : "",
borderColor: errorNode == id ? 'red' : ''
}}
>
{isEmptyNode && (
<div className="flex-1 flex flex-col items-center justify-center">
<GoPlus className="w-8 h-8 text-gray-600 font-bold p-0" />
{selectedNode === id && (
<div className="text-gray-600 font-bold text-center">Go to Toolbox</div>
)}
</div>
)}
{errorNode === id && <BiSolidError className="size-16 text-red-500 absolute right-[-40px] top-[-40px]" />}
{!isEmptyNode && (
<div className="container flex-1 flex flex-row items-center justify-between gap-2 flex-wrap">
{getTriggerIcon(data)}
{!!data && !['interval', 'manual'].includes(data.type) && <Image
src={IconUrlProvider(data) || "/keep.png"}
alt={data?.type}
className="object-cover w-8 h-8 rounded-full bg-gray-100"
width={32}
height={32}
/>}
<div className="flex-1 flex-col gap-2 flex-wrap truncate">
<div className="text-lg font-bold truncate">{data?.name}</div>
<div className="text-gray-500 truncate">
{type}
</div>
</div>
<div>
<NodeMenu data={data} id={id} />
</div>
</div>
)}

<Handle
type="target"
position={Position.Top}
className="w-32"
/>
<Handle
type="source"
position={Position.Bottom}
className="w-32"
/>
</div>}

{specialNodeCheck && <div
style={{
opacity: data.isLayouted ? 1 : 0
}}
onClick={(e) => {
e.stopPropagation();
if(!synced){
toast('Please save the previous step or wait while properties sync with the workflow.');
return;
}
if (type === 'start' || type === 'end' || id?.includes('end')) {
setOpneGlobalEditor(true);
return;
}
setSelectedNode(id);
}}
>
<div className={`flex flex-col items-center justify-center`}>
{type === 'start' && <MdNotStarted className="size-20 bg-orange-500 text-white rounded-full font-bold mb-2" />}
{type === 'end' && <GoSquareFill className="size-20 bg-orange-500 text-white rounded-full font-bold mb-2" />}
{['threshold', 'assert', 'foreach'].includes(type) &&
<div className={`border-2 ${id === selectedNode
? "border-orange-500"
: "border-stone-400"}`}>
{id.includes('end') ? <PiSquareLogoFill className="size-20 rounded bg-white-400 p-2" /> :
<Image
src={IconUrlProvider(data) || "/keep.png"}
alt={data?.type}
className="object-contain size-20 rounded bg-white-400 p-2"
width={32}
height={32}
/>}
</div>
}
{'start' === type && <Handle
type="source"
position={Position.Bottom}
className="w-32"
/>}

{'end' === type && <Handle
type="target"
position={Position.Top}
className="w-32"
/>}
</div>
</div>}
</>
);
}

export default memo(CustomNode);
Loading
Loading