diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 41f8b12..b32fc0e 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -13,6 +13,7 @@ import { localStorageKeys } from '@constants/localStorageKeys.ts' import DefaultUser from '@components/Icons/DefaultUser.tsx' import { MenuItemKeysType, + MenuItemLabelsType, MenuItemType, menuKeys } from '@components/Layout/layout.type.ts' @@ -23,13 +24,15 @@ import { useAppDispatch, useAppSelector } from '@hooks/redux.ts' import useLogout from '@hooks/useLogout.tsx' import useRole from '@hooks/useRole.tsx' -import { fetchProfile } from '@stores/redusers/ActionCreators.ts' +import { fetchProfile, fetchUI } from '@stores/redusers/ActionCreators.ts' import { StateProfileStatus } from '@stores/redusers/ProfileSlice.ts' import { routePaths } from '@routes/routePaths.ts' import { PermissionKeysType } from '@type/roles.type.ts' +import Header from 'src/widgets/Header' + import './layout.scss' const { Content, Sider } = Layout @@ -39,6 +42,7 @@ const LayoutComponent = () => { const [selectedMenuKeys, setSelectedMenuKeys] = useState( [] ) + const [title, setTitle] = useState('') const [openKeys, setOpenKeys] = useState([]) const dispatch = useAppDispatch() const { @@ -143,6 +147,7 @@ const LayoutComponent = () => { useEffect(() => { if (userToken) { dispatch(fetchProfile()) + dispatch(fetchUI()) } }, []) @@ -152,6 +157,7 @@ const LayoutComponent = () => { const menuItem = menuKeys[menuKey] if (menuItem) { + setTitle(MenuItemLabelsType[menuItem.key]) setSelectedMenuKeys([menuItem.key]) setOpenKeys(menuItem.parent) } @@ -197,37 +203,40 @@ const LayoutComponent = () => { } return ( - - {status === StateProfileStatus.pending ? ( - - ) : ( - <> - setCollapsed(value)} - > - setOpenKeys(keys)} - openKeys={openKeys} - selectedKeys={selectedMenuKeys} - onClick={handlerOnClickMenu} +
+
+ + {status === StateProfileStatus.pending ? ( + + ) : ( + <> + - - - - - - - - )} - + collapsible + collapsed={collapsed} + onCollapse={(value) => setCollapsed(value)} + > + setOpenKeys(keys)} + openKeys={openKeys} + selectedKeys={selectedMenuKeys} + onClick={handlerOnClickMenu} + theme="light" + mode="inline" + items={menuItems} + /> + + + + + + + + )} + +
) } diff --git a/src/components/Layout/layout.scss b/src/components/Layout/layout.scss index f1254b7..06a9eda 100644 --- a/src/components/Layout/layout.scss +++ b/src/components/Layout/layout.scss @@ -1,7 +1,7 @@ @import 'src/constants/style/styleConst'; .layout { - min-height: 100vh !important; + min-height: calc(100vh - 65px) !important; position: relative; .hide-item { diff --git a/src/components/Layout/layout.type.ts b/src/components/Layout/layout.type.ts index 493d35e..860ba52 100644 --- a/src/components/Layout/layout.type.ts +++ b/src/components/Layout/layout.type.ts @@ -9,7 +9,18 @@ export enum MenuItemKeysType { logout = 'logout', profile = 'profile', modules = 'modules', - applications = 'applications', + applications = 'applications' +} +export enum MenuItemLabelsType { + users = 'Пользователи', + sessions = 'Пользовательские сессии', + securityLog = 'Просмотр журналов ИБ', + appAccess = 'Доступы приложений', + roles = 'Роли', + profile = 'Профиль', + modules = 'Модули', + applications = 'Группа приложений', + logout = 'Выход', } interface MenuItem { diff --git a/src/components/app.scss b/src/components/app.scss index 6095f4b..d26913c 100644 --- a/src/components/app.scss +++ b/src/components/app.scss @@ -9,7 +9,6 @@ .app{ overflow: hidden; height: 100vh; - padding: 0 $basic-padding; min-height: 0; min-width: 500px; }