From 1dea005599e0e8625dce859e31163299e93ad339 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 24 Mar 2023 14:24:49 -0300 Subject: [PATCH 01/14] import modal created --- .../modals/importModal/buttonBox/index.tsx | 45 +++++++ src/frontend/src/modals/importModal/index.tsx | 118 ++++++++++++++++++ .../components/tabsManagerComponent/index.tsx | 19 ++- src/frontend/src/utils.ts | 1 + 4 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 src/frontend/src/modals/importModal/buttonBox/index.tsx create mode 100644 src/frontend/src/modals/importModal/index.tsx diff --git a/src/frontend/src/modals/importModal/buttonBox/index.tsx b/src/frontend/src/modals/importModal/buttonBox/index.tsx new file mode 100644 index 00000000000..38d2e84bfb5 --- /dev/null +++ b/src/frontend/src/modals/importModal/buttonBox/index.tsx @@ -0,0 +1,45 @@ +import React, { ReactNode } from "react"; +import { DocumentDuplicateIcon } from "@heroicons/react/solid"; +import { classNames } from "../../../utils"; + +export default function ButtonBox({ + onClick, + title, + description, + icon, + bgColor, + textColor, +}: { + onClick: () => void; + title: string; + description: string; + icon: ReactNode; + bgColor: string; + textColor: string; +}) { + return ( + + ); +} diff --git a/src/frontend/src/modals/importModal/index.tsx b/src/frontend/src/modals/importModal/index.tsx new file mode 100644 index 00000000000..70f65dd6c6b --- /dev/null +++ b/src/frontend/src/modals/importModal/index.tsx @@ -0,0 +1,118 @@ +import { Dialog, Transition } from "@headlessui/react"; +import { + XMarkIcon, + ArrowDownTrayIcon, + DocumentDuplicateIcon, + ComputerDesktopIcon, +} from "@heroicons/react/24/outline"; +import { Fragment, useContext, useRef, useState } from "react"; +import { PopUpContext } from "../../contexts/popUpContext"; +import ButtonBox from "./buttonBox"; + +export default function ImportModal() { + const [open, setOpen] = useState(true); + const { closePopUp } = useContext(PopUpContext); + const ref = useRef(); + function setModalOpen(x: boolean) { + setOpen(x); + if (x === false) { + setTimeout(() => { + closePopUp(); + }, 300); + } + } + return ( + + + +
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + Import from + +
+
+
+
+ + } + onClick={() => console.log("sdsds")} + textColor="text-blue-500" + title="Examples" + > + + } + onClick={() => console.log("sdsds")} + textColor="text-blue-500" + title="Local file" + > +
+
+ +
+
+
+
+
+
+
+ ); +} diff --git a/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx index 79240f72085..f40184d93b9 100644 --- a/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx @@ -14,9 +14,11 @@ import { import { PopUpContext } from "../../../../contexts/popUpContext"; import AlertDropdown from "../../../../alerts/alertDropDown"; import { alertContext } from "../../../../contexts/alertContext"; +import ImportModal from "../../../../modals/importModal"; export default function TabsManagerComponent() { - const { flows, addFlow, tabIndex, setTabIndex, uploadFlow, downloadFlow } = useContext(TabsContext); + const { flows, addFlow, tabIndex, setTabIndex, uploadFlow, downloadFlow } = + useContext(TabsContext); const { openPopUp } = useContext(PopUpContext); const AlertWidth = 256; const { dark, setDark } = useContext(darkContext); @@ -50,10 +52,21 @@ export default function TabsManagerComponent() { flow={null} />
- - +
+
+
+
+
+
+ + Export as + +
+
+
+
+ + { + let newFlow = flows[tabIndex]; + newFlow.name = event.target.value; + updateFlow(newFlow); + }} + type="text" + name="name" + value={flows[tabIndex].name ?? null} + placeholder="File name" + id="name" + className="focus:border focus:border-blue block w-full px-3 py-2 border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:border-gray-600 dark:focus:border-blue-500 dark:focus:ring-blue-500" + /> +
+
+ + +
+
+ +
+
+ +
+
+
+ + + + + + + ); +} diff --git a/src/frontend/src/modals/importModal/index.tsx b/src/frontend/src/modals/importModal/index.tsx index c069a437503..f4c09df1b02 100644 --- a/src/frontend/src/modals/importModal/index.tsx +++ b/src/frontend/src/modals/importModal/index.tsx @@ -4,6 +4,7 @@ import { ArrowDownTrayIcon, DocumentDuplicateIcon, ComputerDesktopIcon, + ArrowUpTrayIcon, } from "@heroicons/react/24/outline"; import { Fragment, useContext, useRef, useState } from "react"; import { PopUpContext } from "../../contexts/popUpContext"; @@ -70,7 +71,7 @@ export default function ImportModal() {
-