////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: /Data/WebUI/src/Flow_Tabs.jsx import React from "react"; import { Box, Tabs, Tab } from "@mui/material"; import { Add as AddIcon } from "@mui/icons-material"; /** * Renders the tab bar (including the "add tab" button). * * Props: * - tabs (array of {id, tab_name, nodes, edges}) * - activeTabId (string) * - onTabChange(newActiveTabId: string) * - onAddTab() * - onTabRightClick(evt: MouseEvent, tabId: string) */ export default function FlowTabs({ tabs, activeTabId, onTabChange, onAddTab, onTabRightClick }) { // Determine the currently active tab index const activeIndex = (() => { const idx = tabs.findIndex((t) => t.id === activeTabId); return idx >= 0 ? idx : 0; })(); // Handle tab clicks const handleChange = (event, newValue) => { if (newValue === "__addtab__") { // The "plus" tab onAddTab(); } else { // normal tab index const newTab = tabs[newValue]; if (newTab) { onTabChange(newTab.id); } } }; return ( {tabs.map((tab, index) => ( onTabRightClick(evt, tab.id)} sx={{ minHeight: "36px", height: "36px", textTransform: "none", backgroundColor: tab.id === activeTabId ? "#2C2C2C" : "transparent", color: "#58a6ff" }} /> ))} {/* The "plus" tab has a special value */} } value="__addtab__" sx={{ minHeight: "36px", height: "36px", color: "#58a6ff", textTransform: "none" }} /> ); }