chore: remove unnecessary code and remove title from Navbar prop

This commit is contained in:
ValdiANS
2026-01-23 23:00:44 +07:00
parent d46652cb68
commit 146a63fc70
+1 -35
View File
@@ -78,40 +78,6 @@ const MainDrawer = ({
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 = () => {
setMainDrawerOpen(!mainDrawerOpen);
};
@@ -132,7 +98,7 @@ const MainDrawer = ({
}}
>
<main className='w-full h-full flex flex-col'>
<Navbar title={pageTitle as string} toggleSidebar={toggleSidebar} />
<Navbar toggleSidebar={toggleSidebar} />
{children}
</main>