mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
remove project router, make everything from root
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
import { FC, useContext } from 'react';
|
||||
|
||||
import { List } from '@mui/material';
|
||||
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
|
||||
import { PROJECT_PATH } from 'api/env';
|
||||
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import TuneIcon from '@mui/icons-material/Tune';
|
||||
import DashboardIcon from '@mui/icons-material/Dashboard';
|
||||
import LayoutMenuItem from 'components/layout/LayoutMenuItem';
|
||||
import InfoIcon from '@mui/icons-material/Info';
|
||||
|
||||
const ProjectMenu: FC = () => {
|
||||
const authenticatedContext = useContext(AuthenticatedContext);
|
||||
const { LL } = useI18nContext();
|
||||
|
||||
return (
|
||||
<List>
|
||||
<LayoutMenuItem icon={DashboardIcon} label={LL.DASHBOARD()} to={`/${PROJECT_PATH}/dashboard`} />
|
||||
<LayoutMenuItem
|
||||
icon={TuneIcon}
|
||||
label={LL.SETTINGS_OF('')}
|
||||
to={`/${PROJECT_PATH}/settings`}
|
||||
disabled={!authenticatedContext.me.admin}
|
||||
/>
|
||||
<LayoutMenuItem icon={InfoIcon} label={LL.HELP_OF('')} to={`/${PROJECT_PATH}/help`} />
|
||||
</List>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProjectMenu;
|
||||
@@ -1,28 +0,0 @@
|
||||
import { FC } from 'react';
|
||||
import { Navigate, Routes, Route } from 'react-router-dom';
|
||||
|
||||
import { RequireAdmin } from 'components';
|
||||
|
||||
import Dashboard from './Dashboard';
|
||||
import Settings from './Settings';
|
||||
import Help from './Help';
|
||||
|
||||
const ProjectRouting: FC = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="dashboard/*" element={<Dashboard />} />
|
||||
<Route
|
||||
path="settings/*"
|
||||
element={
|
||||
<RequireAdmin>
|
||||
<Settings />
|
||||
</RequireAdmin>
|
||||
}
|
||||
/>
|
||||
<Route path="help/*" element={<Help />} />
|
||||
<Route path="/*" element={<Navigate to="dashboard/data" />} />
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProjectRouting;
|
||||
Reference in New Issue
Block a user