2021-02-24 11:03:18 +01:00
|
|
|
import React from 'react';
|
2022-02-08 11:44:41 +01:00
|
|
|
import { NavLink, useLocation } from 'react-router-dom';
|
|
|
|
import { Paper, Tab, Tabs } from '@material-ui/core';
|
2022-02-04 10:36:08 +01:00
|
|
|
import useUiConfig from '../../../hooks/api/getters/useUiConfig/useUiConfig';
|
2021-03-30 15:14:02 +02:00
|
|
|
|
|
|
|
const navLinkStyle = {
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
width: '100%',
|
|
|
|
textDecoration: 'none',
|
|
|
|
color: 'inherit',
|
|
|
|
padding: '0.8rem 1.5rem',
|
|
|
|
};
|
|
|
|
|
2022-02-08 11:44:41 +01:00
|
|
|
const activeNavLinkStyle: React.CSSProperties = {
|
2021-03-30 15:14:02 +02:00
|
|
|
fontWeight: 'bold',
|
|
|
|
borderRadius: '3px',
|
|
|
|
padding: '0.8rem 1.5rem',
|
|
|
|
};
|
|
|
|
|
2022-02-08 11:44:41 +01:00
|
|
|
function AdminMenu() {
|
2022-01-14 15:50:02 +01:00
|
|
|
const { uiConfig } = useUiConfig();
|
2022-02-08 11:44:41 +01:00
|
|
|
const { pathname } = useLocation();
|
2022-01-14 15:50:02 +01:00
|
|
|
const { flags } = uiConfig;
|
2021-12-14 10:36:19 +01:00
|
|
|
|
2021-02-24 11:03:18 +01:00
|
|
|
return (
|
2022-01-14 15:50:02 +01:00
|
|
|
<Paper
|
|
|
|
style={{
|
|
|
|
marginBottom: '1rem',
|
|
|
|
borderRadius: '12.5px',
|
|
|
|
boxShadow: 'none',
|
|
|
|
}}
|
|
|
|
>
|
2021-05-18 12:59:48 +02:00
|
|
|
<Tabs centered value={pathname}>
|
|
|
|
<Tab
|
|
|
|
value="/admin/users"
|
|
|
|
label={
|
|
|
|
<NavLink
|
|
|
|
to="/admin/users"
|
|
|
|
activeStyle={activeNavLinkStyle}
|
|
|
|
style={navLinkStyle}
|
|
|
|
>
|
2021-04-16 11:31:47 +02:00
|
|
|
<span>Users</span>
|
2021-05-18 12:59:48 +02:00
|
|
|
</NavLink>
|
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2022-01-14 15:50:02 +01:00
|
|
|
{flags.RE && (
|
2021-12-14 10:36:19 +01:00
|
|
|
<Tab
|
|
|
|
value="/admin/roles"
|
|
|
|
label={
|
|
|
|
<NavLink
|
|
|
|
to="/admin/roles"
|
|
|
|
activeStyle={activeNavLinkStyle}
|
|
|
|
style={navLinkStyle}
|
|
|
|
>
|
|
|
|
<span>PROJECT ROLES</span>
|
|
|
|
</NavLink>
|
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2021-12-14 10:36:19 +01:00
|
|
|
)}
|
|
|
|
|
2021-05-18 12:59:48 +02:00
|
|
|
<Tab
|
|
|
|
value="/admin/api"
|
|
|
|
label={
|
|
|
|
<NavLink
|
|
|
|
to="/admin/api"
|
|
|
|
activeStyle={activeNavLinkStyle}
|
|
|
|
style={navLinkStyle}
|
|
|
|
>
|
|
|
|
API Access
|
|
|
|
</NavLink>
|
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2021-05-18 12:59:48 +02:00
|
|
|
<Tab
|
|
|
|
value="/admin/auth"
|
|
|
|
label={
|
|
|
|
<NavLink
|
|
|
|
to="/admin/auth"
|
|
|
|
activeStyle={activeNavLinkStyle}
|
|
|
|
style={navLinkStyle}
|
|
|
|
>
|
2021-12-14 10:36:19 +01:00
|
|
|
Single Sign-On
|
2021-05-18 12:59:48 +02:00
|
|
|
</NavLink>
|
2021-04-16 11:31:47 +02:00
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2021-04-16 11:31:47 +02:00
|
|
|
</Tabs>
|
|
|
|
</Paper>
|
2021-02-24 11:03:18 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default AdminMenu;
|