From 41cbd918b7c08b4e0a8e58f558b72e7f9f60ae16 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 20 Mar 2024 18:32:52 +0100 Subject: [PATCH] Deleted variables page --- .../components/parameterComponent/index.tsx | 2 +- .../addNewVariableButton.tsx | 18 +++--- .../src/pages/globalVariablesPage/index.tsx | 58 ------------------- src/frontend/src/routes.tsx | 9 --- 4 files changed, 10 insertions(+), 77 deletions(-) rename src/frontend/src/{pages/globalVariablesPage/components => components/addNewVariableButtonComponent}/addNewVariableButton.tsx (81%) delete mode 100644 src/frontend/src/pages/globalVariablesPage/index.tsx diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 2bc10df64..a0fda55fd 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -24,7 +24,7 @@ import { OUTPUT_HANDLER_HOVER, TOOLTIP_EMPTY, } from "../../../../constants/constants"; -import AddNewVariableButton from "../../../../pages/globalVariablesPage/components/addNewVariableButton"; +import AddNewVariableButton from "../../../../components/addNewVariableButtonComponent/addNewVariableButton"; import useAlertStore from "../../../../stores/alertStore"; import useFlowStore from "../../../../stores/flowStore"; import useFlowsManagerStore from "../../../../stores/flowsManagerStore"; diff --git a/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx b/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx similarity index 81% rename from src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx rename to src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx index d2ab94134..84e7d1c7a 100644 --- a/src/frontend/src/pages/globalVariablesPage/components/addNewVariableButton.tsx +++ b/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx @@ -1,13 +1,13 @@ import { useState } from "react"; -import ForwardedIconComponent from "../../../components/genericIconComponent"; -import InputComponent from "../../../components/inputComponent"; -import { Button } from "../../../components/ui/button"; -import { Input } from "../../../components/ui/input"; -import { Label } from "../../../components/ui/label"; -import { Textarea } from "../../../components/ui/textarea"; -import { registerGlobalVariable } from "../../../controllers/API"; -import BaseModal from "../../../modals/baseModal"; -import { useGlobalVariablesStore } from "../../../stores/globalVariables"; +import ForwardedIconComponent from "../genericIconComponent"; +import InputComponent from "../inputComponent"; +import { Button } from "../ui/button"; +import { Input } from "../ui/input"; +import { Label } from "../ui/label"; +import { Textarea } from "../ui/textarea"; +import { registerGlobalVariable } from "../../controllers/API"; +import BaseModal from "../../modals/baseModal"; +import { useGlobalVariablesStore } from "../../stores/globalVariables"; //TODO IMPLEMENT FORM LOGIC diff --git a/src/frontend/src/pages/globalVariablesPage/index.tsx b/src/frontend/src/pages/globalVariablesPage/index.tsx deleted file mode 100644 index 5a9a6fabf..000000000 --- a/src/frontend/src/pages/globalVariablesPage/index.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import ShadTooltip from "../../components/ShadTooltipComponent"; -import IconComponent from "../../components/genericIconComponent"; -import PageLayout from "../../components/pageLayout"; -import { deleteGlobalVariable } from "../../controllers/API"; -import { useGlobalVariablesStore } from "../../stores/globalVariables"; -import AddNewVariableButton from "./components/addNewVariableButton"; - -//TODO: improve UI - -export default function GlobalVariablesPage() { - const globalVariablesEntries = useGlobalVariablesStore( - (state) => state.globalVariablesEntries - ); - const getVariableId = useGlobalVariablesStore((state) => state.getVariableId); - const removeGlobalVariable = useGlobalVariablesStore( - (state) => state.removeGlobalVariable - ); - - function handleDelete(key: string) { - const id = getVariableId(key); - if(id!==undefined) - { - deleteGlobalVariable(id).then((_) => removeGlobalVariable(key)); - - }else{ - console.error("id is undefined"); - } - } - return ( - - {globalVariablesEntries.length > 0 ? ( -
- {globalVariablesEntries.map((key, index) => ( -
- {key} - - - -
- ))} - -
- ) : ( -
-
-

create your first variable

- -
-
- )} -
- ); -} diff --git a/src/frontend/src/routes.tsx b/src/frontend/src/routes.tsx index 0c3cd1ac8..b48e5147d 100644 --- a/src/frontend/src/routes.tsx +++ b/src/frontend/src/routes.tsx @@ -15,7 +15,6 @@ import ProfileSettingsPage from "./pages/ProfileSettingsPage"; import StorePage from "./pages/StorePage"; import ViewPage from "./pages/ViewPage"; import DeleteAccountPage from "./pages/deleteAccountPage"; -import GlobalVariablesPage from "./pages/globalVariablesPage"; import LoginPage from "./pages/loginPage"; import SignUp from "./pages/signUpPage"; @@ -154,14 +153,6 @@ const Router = () => { } > - - - - } - > ); };