diff --git a/src/frontend/src/modals/importModal/buttonBox/index.tsx b/src/frontend/src/modals/importModal/buttonBox/index.tsx deleted file mode 100644 index 131dcec31..000000000 --- a/src/frontend/src/modals/importModal/buttonBox/index.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { buttonBoxPropsType } from "../../../types/components"; -import { classNames } from "../../../utils/utils"; - -export default function ButtonBox({ - onClick, - title, - description, - icon, - bgColor, - textColor, - deactivate, - size, -}: buttonBoxPropsType): JSX.Element { - let bigCircle: string; - let smallCircle: string; - let titleFontSize: string; - let descriptionFontSize: string; - let padding: string; - let marginTop: string; - let height: string; - let width: string; - let textHeight: number; - let textWidth: number; - switch (size) { - case "small": - bigCircle = "h-12 w-12"; - smallCircle = "h-8 w-8"; - titleFontSize = "text-sm"; - descriptionFontSize = "text-xs"; - padding = "p-2 py-3"; - marginTop = "mt-2"; - height = "h-36"; - width = "w-32"; - break; - case "medium": - bigCircle = "h-16 w-16"; - smallCircle = "h-12 w-12"; - titleFontSize = "text-base"; - descriptionFontSize = "text-sm"; - padding = "p-4 py-5"; - marginTop = "mt-3"; - height = "h-44"; - width = "w-36"; - break; - case "big": - bigCircle = "h-20 w-20"; - smallCircle = "h-16 w-16"; - titleFontSize = "text-lg"; - descriptionFontSize = "text-sm"; - padding = "p-8 py-10"; - marginTop = "mt-6"; - height = "h-56"; - width = "w-44"; - break; - default: - bigCircle = "h-20 w-20"; - smallCircle = "h-16 w-16"; - titleFontSize = "text-lg"; - descriptionFontSize = "text-sm"; - padding = "p-8 py-10"; - marginTop = "mt-6"; - height = "h-56"; - width = "w-44"; - break; - } - - return ( - - ); -} diff --git a/src/frontend/src/modals/importModal/index.tsx b/src/frontend/src/modals/importModal/index.tsx deleted file mode 100644 index 6557783c4..000000000 --- a/src/frontend/src/modals/importModal/index.tsx +++ /dev/null @@ -1,190 +0,0 @@ -import { - ArrowLeftIcon, - ArrowUpTrayIcon, - ComputerDesktopIcon, - DocumentDuplicateIcon, -} from "@heroicons/react/24/outline"; -import { useContext, useRef, useState } from "react"; -import LoadingComponent from "../../components/loadingComponent"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "../../components/ui/dialog"; -import { IMPORT_DIALOG_SUBTITLE } from "../../constants/constants"; -import { alertContext } from "../../contexts/alertContext"; -import { TabsContext } from "../../contexts/tabsContext"; -import { getExamples } from "../../controllers/API"; -import { FlowType } from "../../types/flow"; -import { classNames } from "../../utils/utils"; -import ButtonBox from "./buttonBox"; - -export default function ImportModal(): JSX.Element { - const [open, setOpen] = useState(true); - const { setErrorData } = useContext(alertContext); - const ref = useRef(); - const [showExamples, setShowExamples] = useState(false); - const [loadingExamples, setLoadingExamples] = useState(false); - const [examples, setExamples] = useState([]); - const { uploadFlow, addFlow } = useContext(TabsContext); - - function handleExamples(): void { - setLoadingExamples(true); - getExamples() - .then((result) => { - setLoadingExamples(false); - setExamples(result); - }) - .catch((error) => - setErrorData({ - title: "there was an error loading examples, please try again", - list: [error.message], - }) - ); - } - - const [modalOpen, setModalOpen] = useState(false); - - return ( - - - - - - {showExamples && ( - <> -
- -
- - )} - - - {showExamples ? "Select an example" : "Import"} - -
- {IMPORT_DIALOG_SUBTITLE} -
- -
- {!showExamples && ( -
- } - onClick={() => { - setShowExamples(true); - handleExamples(); - }} - textColor="text-medium-emerald " - title="Examples" - > - } - onClick={() => { - uploadFlow(); - setModalOpen(false); - }} - textColor="text-almost-dark-blue " - title="Local File" - > -
- )} - {showExamples && loadingExamples && ( -
- -
- )} - {showExamples && - !loadingExamples && - examples.map((example, index) => { - return ( -
- {" "} - - } - onClick={() => { - addFlow(example, false); - setModalOpen(false); - }} - textColor="text-medium-emerald " - title={example.name} - > -
- ); - })} -
- - -
- - - - - Langflow Examples - -
-
-
-
- ); -} diff --git a/src/frontend/src/pages/MainPage/index.tsx b/src/frontend/src/pages/MainPage/index.tsx index 9582d4c57..92be2525a 100644 --- a/src/frontend/src/pages/MainPage/index.tsx +++ b/src/frontend/src/pages/MainPage/index.tsx @@ -71,7 +71,7 @@ export default function HomePage(): JSX.Element { { - addFlow(null!, true).then((id) => { + addFlow(undefined, true).then((id) => { navigate("/flow/" + id); }); }}