diff --git a/src/components/Workflow/Node.tsx b/src/components/Workflow/Node.tsx index eb4024c8d..8cdfea04e 100644 --- a/src/components/Workflow/Node.tsx +++ b/src/components/Workflow/Node.tsx @@ -1,9 +1,11 @@ import { Box, Menu, MenuItem, MenuList, Paper, Stack } from "@mui/material"; import { FC, PropsWithChildren, useCallback, useState } from "react"; -export interface INodeProps {} +export interface INodeProps { + options?: Array<{ label: string; onClick: () => void }>; +} -const Node: FC> = ({ children }) => { +const Node: FC> = ({ options, children }) => { const [position, setPosition] = useState<{ top: number; left: number; @@ -47,6 +49,16 @@ const Node: FC> = ({ children }) => { anchorPosition={position!} > + {options?.map(({ label, onClick }) => ( + { + setPosition(null); + onClick(); + }} + > + {label} + + ))} Rename diff --git a/src/components/Workflow/ScriptNode.tsx b/src/components/Workflow/ScriptNode.tsx index 88483dc3d..45dc1c293 100644 --- a/src/components/Workflow/ScriptNode.tsx +++ b/src/components/Workflow/ScriptNode.tsx @@ -1,4 +1,4 @@ -import { Box, Drawer, Stack } from "@mui/material"; +import { Drawer, Stack } from "@mui/material"; import CodeEditor from "@src/components/CodeEditor"; import { map } from "lodash-es"; import { FC, SVGProps, useCallback, useEffect, useState } from "react"; @@ -94,11 +94,18 @@ const ScriptNode: FC = ({}) => { return ( <> - + { + setIsEditing(true); + }, + }, + ]} + > - setIsEditing(true)}> - - +