diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 64f7de21e..25e786a47 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -42,6 +42,7 @@ import { import { isWrappedWithClass } from "../../../../utils/utils"; import ConnectionLineComponent from "../ConnectionLineComponent"; import ExtraSidebar from "../extraSidebarComponent"; +import SelectionMenu from "../SelectionMenuComponent"; const nodeTypes = { genericNode: GenericNode, diff --git a/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx new file mode 100644 index 000000000..6a01b1bf7 --- /dev/null +++ b/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx @@ -0,0 +1,55 @@ +import {useEffect, useState } from "react"; +import { NodeToolbar } from "reactflow"; +import IconComponent from "../../../../components/genericIconComponent"; +export default function SelectionMenu({ onClick, nodes, isVisible }) { + const [isOpen, setIsOpen] = useState(false); + const [isTransitioning, setIsTransitioning] = useState(false); + const [lastNodes, setLastNodes] = useState(nodes); + + // nodes get saved to not be gone after the toolbar closes + useEffect(() => { + setLastNodes(nodes); + }, [isOpen]); + + // transition starts after and ends before the toolbar closes + useEffect(() => { + if (isVisible) { + setIsOpen(true); + setTimeout(() => { + setIsTransitioning(true); + }, 50); + } else { + setIsTransitioning(false); + setTimeout(() => { + setIsOpen(false); + }, 500); + } + }, [isVisible]); + + return ( + 0 ? lastNodes.map((n) => n.id) : [] + } + > +
+
+ +
+
+
+ ); +} diff --git a/src/frontend/src/utils/styleUtils.ts b/src/frontend/src/utils/styleUtils.ts index 31a7adf7e..d5d4af23f 100644 --- a/src/frontend/src/utils/styleUtils.ts +++ b/src/frontend/src/utils/styleUtils.ts @@ -74,6 +74,7 @@ import { X, XCircle, Zap, + Group } from "lucide-react"; import { FaApple, FaGithub } from "react-icons/fa"; import { AirbyteIcon } from "../icons/Airbyte"; @@ -300,4 +301,5 @@ export const nodeIconsLucide: iconsType = { UserCog2, Key, Unplug, + Group };