mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
Currently our bundle size is clocking in at: 1,798.28 kB │ gzip: 558.42 kB After the changes: 1,299.32 kB │ gzip: 403.26 kB
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import { lazy } from 'react';
|
|
|
|
import { styled, Tab, Tabs } from '@mui/material';
|
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
import { CenteredNavLink } from '../menu/CenteredNavLink';
|
|
import { PageContent } from 'component/common/PageContent/PageContent';
|
|
|
|
const NetworkOverview = lazy(() => import('./NetworkOverview/NetworkOverview'));
|
|
const NetworkTraffic = lazy(() => import('./NetworkTraffic/NetworkTraffic'));
|
|
|
|
const StyledPageContent = styled(PageContent)(() => ({
|
|
'.page-header': {
|
|
padding: 0,
|
|
},
|
|
}));
|
|
|
|
const tabs = [
|
|
{
|
|
label: 'Overview',
|
|
path: '/admin/network',
|
|
},
|
|
{
|
|
label: 'Traffic',
|
|
path: '/admin/network/traffic',
|
|
},
|
|
];
|
|
|
|
export const Network = () => {
|
|
const { pathname } = useLocation();
|
|
|
|
return (
|
|
<div>
|
|
<StyledPageContent
|
|
headerClass="page-header"
|
|
header={
|
|
<Tabs
|
|
value={pathname}
|
|
indicatorColor="primary"
|
|
textColor="primary"
|
|
variant="scrollable"
|
|
allowScrollButtonsMobile
|
|
>
|
|
{tabs.map(({ label, path }) => (
|
|
<Tab
|
|
key={label}
|
|
value={path}
|
|
label={
|
|
<CenteredNavLink to={path}>
|
|
<span>{label}</span>
|
|
</CenteredNavLink>
|
|
}
|
|
/>
|
|
))}
|
|
</Tabs>
|
|
}
|
|
>
|
|
<Routes>
|
|
<Route path="traffic" element={<NetworkTraffic />} />
|
|
<Route path="*" element={<NetworkOverview />} />
|
|
</Routes>
|
|
</StyledPageContent>
|
|
</div>
|
|
);
|
|
};
|