mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { Navigate, Route, Routes, matchRoutes, useLocation } from 'react-router';
|
|
|
|
import { Tab } from '@mui/material';
|
|
|
|
import { RouterTabs, useLayoutTitle } from 'components';
|
|
import { useI18nContext } from 'i18n/i18n-react';
|
|
|
|
import ManageUsers from './ManageUsers';
|
|
import SecuritySettings from './SecuritySettings';
|
|
|
|
const Security = () => {
|
|
const { LL } = useI18nContext();
|
|
useLayoutTitle(LL.SECURITY(0));
|
|
|
|
const matchedRoutes = matchRoutes(
|
|
[
|
|
{ path: '/settings/security/settings', element: <ManageUsers />, dog: 'woof' },
|
|
{ path: '/settings/security/users', element: <SecuritySettings /> }
|
|
],
|
|
useLocation()
|
|
);
|
|
const routerTab = matchedRoutes?.[0]?.route.path || false;
|
|
|
|
return (
|
|
<>
|
|
<RouterTabs value={routerTab}>
|
|
<Tab
|
|
value="/settings/security/settings"
|
|
label={LL.SETTINGS_OF(LL.SECURITY(1))}
|
|
/>
|
|
<Tab value="/settings/security/users" label={LL.MANAGE_USERS()} />
|
|
</RouterTabs>
|
|
<Routes>
|
|
<Route path="users" element={<ManageUsers />} />
|
|
<Route path="settings" element={<SecuritySettings />} />
|
|
<Route
|
|
path="*"
|
|
element={<Navigate replace to="/settings/security/settings" />}
|
|
/>
|
|
</Routes>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Security;
|