From b45966051ab8e795bad69ab850603d593feb7211 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 12 Jun 2023 19:23:34 -0300 Subject: [PATCH] fixed header to new logic --- src/frontend/src/App.tsx | 2 +- .../src/components/headerComponent/index.tsx | 6 +++--- .../MainPage/components/menuBar/index.tsx | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 466cab8b2..a8e896aa1 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -135,7 +135,7 @@ export default function App() { > {flows.length !== 0 && ( <> - {/*
*/} +
)} diff --git a/src/frontend/src/components/headerComponent/index.tsx b/src/frontend/src/components/headerComponent/index.tsx index 955065956..8c741091f 100644 --- a/src/frontend/src/components/headerComponent/index.tsx +++ b/src/frontend/src/components/headerComponent/index.tsx @@ -15,8 +15,8 @@ export default function Header(){ flows, addFlow, removeFlow, - tabIndex, - setTabIndex, + tabId, + setTabId, uploadFlow, downloadFlow, } = useContext(TabsContext); @@ -41,7 +41,7 @@ export default function Header(){ setRename={setRename} rename={rename} flows={flows} - tabIndex={tabIndex} + tabId={tabId} />
diff --git a/src/frontend/src/pages/MainPage/components/menuBar/index.tsx b/src/frontend/src/pages/MainPage/components/menuBar/index.tsx index b19dabbf3..c1c94a2cd 100644 --- a/src/frontend/src/pages/MainPage/components/menuBar/index.tsx +++ b/src/frontend/src/pages/MainPage/components/menuBar/index.tsx @@ -20,8 +20,8 @@ import ApiModal from "../../../../modals/ApiModal"; import { alertContext } from "../../../../contexts/alertContext"; import { updateFlowInDatabase } from "../../../../controllers/API"; -export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { - const { updateFlow, setTabIndex, addFlow } = useContext(TabsContext); +export const MenuBar = ({ activeTab, setRename, rename, flows, tabId }) => { + const { updateFlow, setTabId, addFlow } = useContext(TabsContext); const { setErrorData } = useContext(alertContext); const { openPopUp } = useContext(PopUpContext); @@ -42,7 +42,7 @@ export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { setErrorData(err); } } - let current_flow = flows[tabIndex]; + let current_flow = flows.find((flow) => flow.id === tabId); // robot emoji let emoji = current_flow.style?.emoji || "🤖"; @@ -63,10 +63,10 @@ export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { {emoji} { if (value !== "") { - let newFlow = _.cloneDeep(flows[tabIndex]); + let newFlow = _.cloneDeep(current_flow); newFlow.name = value; updateFlow(newFlow); } @@ -97,7 +97,7 @@ export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { { - openPopUp(); + openPopUp(); }} > @@ -110,7 +110,7 @@ export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { { - handleSaveFlow(flows[tabIndex]); + handleSaveFlow(current_flow); }} > @@ -130,9 +130,9 @@ export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { Flows { - setTabIndex(parseInt(value)); + setTabId(value); }} > {flows.map((flow, idx) => {