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} - - handleDelete(key)} className="ml-auto"> - - - - - ))} - - - ) : ( - - - 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 = () => { } > - - - - } - > ); };
create your first variable