mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore: remove unnecessary code and remove title from Navbar prop
This commit is contained in:
@@ -78,40 +78,6 @@ const MainDrawer = ({
|
|||||||
permissionCheck(permission)
|
permissionCheck(permission)
|
||||||
);
|
);
|
||||||
|
|
||||||
const getPageTitle = useCallback(() => {
|
|
||||||
let title = '';
|
|
||||||
|
|
||||||
const activeMenu = MAIN_DRAWER_LINKS.find((item) =>
|
|
||||||
isPathActive(pathname, item.link)
|
|
||||||
);
|
|
||||||
|
|
||||||
const traverseMenuTitle = (menu: typeof activeMenu) => {
|
|
||||||
if (!menu) return;
|
|
||||||
|
|
||||||
const hasSubmenu = menu?.submenu && menu?.submenu.length > 0;
|
|
||||||
|
|
||||||
if (!title) {
|
|
||||||
title += menu?.text;
|
|
||||||
} else {
|
|
||||||
title += ' - ' + menu?.text;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasSubmenu || !menu.submenu) return;
|
|
||||||
|
|
||||||
const activeSubmenu = menu.submenu?.find((item) =>
|
|
||||||
isPathActive(pathname, item.link)
|
|
||||||
);
|
|
||||||
|
|
||||||
traverseMenuTitle(activeSubmenu);
|
|
||||||
};
|
|
||||||
|
|
||||||
traverseMenuTitle(activeMenu);
|
|
||||||
|
|
||||||
return title;
|
|
||||||
}, [pathname]);
|
|
||||||
|
|
||||||
const pageTitle = getPageTitle();
|
|
||||||
|
|
||||||
const toggleSidebar = () => {
|
const toggleSidebar = () => {
|
||||||
setMainDrawerOpen(!mainDrawerOpen);
|
setMainDrawerOpen(!mainDrawerOpen);
|
||||||
};
|
};
|
||||||
@@ -132,7 +98,7 @@ const MainDrawer = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<main className='w-full h-full flex flex-col'>
|
<main className='w-full h-full flex flex-col'>
|
||||||
<Navbar title={pageTitle as string} toggleSidebar={toggleSidebar} />
|
<Navbar toggleSidebar={toggleSidebar} />
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user