diff --git a/space_flow/src/pages/FlowPage/flowManager/index.tsx b/space_flow/src/pages/FlowPage/flowManager/index.tsx index ce978a2a4..925a75f3e 100644 --- a/space_flow/src/pages/FlowPage/flowManager/index.tsx +++ b/space_flow/src/pages/FlowPage/flowManager/index.tsx @@ -4,39 +4,47 @@ import { ReactFlowProvider } from "reactflow"; import FlowPage from ".."; import { TabsContext } from "../../../contexts/tabsContext"; import TabComponent from "./tabComponent"; -import { PlusIcon } from '@heroicons/react/24/outline'; +import { PlusIcon } from "@heroicons/react/24/outline"; var _ = require("lodash"); export function TabsManager() { - const { flows, addFlow, tabIndex, setTabIndex } = useContext(TabsContext); - const [inputMode,setInputMode] = useState(false) - useEffect(() => { - if (flows.length === 0) { - const id = _.uniqueId() - addFlow({ name: "flow "+id, data: null, id }); - } - }, []); + const { flows, addFlow, tabIndex, setTabIndex } = useContext(TabsContext); + useEffect(() => { + if (flows.length === 0) { + const id = _.uniqueId(); + addFlow({ name: "flow " + id, data: null, id }); + } + }, []); - return ( -
-
- {flows.map((flow, index) => { - console.log(tabIndex) - return ( - setTabIndex(index)} selected={index === tabIndex} key={index} id={flow.id}> -
setInputMode(true)}>{flow.name}
-
- ); - })} -
{ - const id = _.uniqueId() - addFlow({ name: "flow"+id, data: null, id})}} className="cursor-pointer">
-
-
- - - -
-
- ); + return ( +
+
+ {flows.map((flow, index) => { + console.log(tabIndex); + return ( + setTabIndex(index)} + selected={index === tabIndex} + key={index} + flow={flow} + /> + ); + })} + { + const id = _.uniqueId(); + addFlow({ name: "flow" + id, data: null, id }); + }} + selected={false} + key={0} + flow={null} + /> +
+
+ + + +
+
+ ); } diff --git a/space_flow/src/pages/FlowPage/flowManager/tabComponent/index.tsx b/space_flow/src/pages/FlowPage/flowManager/tabComponent/index.tsx index b19dd03c4..3cdaf6b8b 100644 --- a/space_flow/src/pages/FlowPage/flowManager/tabComponent/index.tsx +++ b/space_flow/src/pages/FlowPage/flowManager/tabComponent/index.tsx @@ -1,31 +1,49 @@ import { PlusIcon, XMarkIcon } from "@heroicons/react/24/solid"; import { useContext } from "react"; import { TabsContext } from "../../../../contexts/tabsContext"; -import { classNames } from "../../../../utils"; -export default function TabComponent({ selected, flow, id, onClick}) { - const { removeFlow, flows } = useContext(TabsContext); - return ( - <> +export default function TabComponent({ selected, flow, onClick }) { + const { removeFlow } = useContext(TabsContext); + return ( + <> {flow ? ( - selected ? ( - + + ) : ( -
+
{flow.name} +
) ) : (
-
)} - )} \ No newline at end of file + ); +}