diff --git a/app/layouts/admin/sidebar.tsx b/app/layouts/admin/sidebar.tsx index 17fd1c2..4d7c0e2 100644 --- a/app/layouts/admin/sidebar.tsx +++ b/app/layouts/admin/sidebar.tsx @@ -5,11 +5,8 @@ import { MENU } from './menu' export const Sidebar = () => { const { pathname } = useLocation() - const path = () => { - // Extract the first three segments for deep paths, otherwise use the full pathname - const segments = pathname.split('/') - return segments.length > 3 ? segments.slice(0, 3).join('/') : pathname - } + const segments = pathname.split('/') + const path = segments.length > 3 ? segments.slice(0, 3).join('/') : pathname return (
@@ -24,19 +21,19 @@ export const Sidebar = () => { to={url} key={`${group}-${title}`} className={twMerge( - path() === url ? 'bg-[#707FDD]/10 font-bold' : '', + path === url ? 'bg-[#707FDD]/10 font-bold' : '', 'group/menu flex h-[42px] w-[200px] items-center gap-x-3 rounded-md px-5 transition-all hover:bg-[#707FDD]/10', )} >