Skip to content

Commit

Permalink
fix: restore tabs on left panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Tethik committed Oct 28, 2024
1 parent 1974679 commit 6ac94b4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/src/components/model/panels/left/LeftPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ComponentTab } from "./ComponentTab";
import { DataFlowTab } from "./DataFlowTab";
import { LeftFooter } from "./Footer";
import { SystemTab } from "./SystemTab";
import { AppBar, Drawer, Grow, Tab, Tabs, Toolbar } from "@mui/material";

const TAB = {
SYSTEM: 0,
Expand Down Expand Up @@ -64,6 +65,9 @@ export function LeftPanel() {
return null;
}

// This fixes an annoying MUI console error when you deselect a component
const tabHck = !selectedComponent && tab === TAB.COMPONENT ? TAB.SYSTEM : tab;

return (
<Box
id="panel-left"
Expand All @@ -77,6 +81,31 @@ export function LeftPanel() {
>
<ToggleLeftPanelButton />

<AppBar position="static">
<Grow in={true}>
<Tabs
value={tabHck}
onChange={(_, v) => setTab(v)}
textColor="inherit"
variant="fullWidth"
sx={{
"& .MuiTabs-indicator": {
backgroundColor: (theme) => theme.palette.common.gramPink,
},
}}
>
<Tab disableRipple label="SYSTEM" value={TAB.SYSTEM} />
<Tab disableRipple label="ACTION ITEMS" value={TAB.ACTION_ITEMS} />
{isComponent && (
<Tab disableRipple label="COMPONENT" value={TAB.COMPONENT} />
)}
{isDataFlow && (
<Tab disableRipple label="DATA FLOW" value={TAB.DATA_FLOW} />
)}
</Tabs>
</Grow>
</AppBar>

<TabPanel value={tab} index={TAB.SYSTEM}>
<SystemTab />
</TabPanel>
Expand All @@ -89,6 +118,7 @@ export function LeftPanel() {
<TabPanel value={tab} index={TAB.DATA_FLOW}>
{isDataFlow && <DataFlowTab />}
</TabPanel>

<LeftFooter />
</Box>
);
Expand Down

0 comments on commit 6ac94b4

Please sign in to comment.