diff --git a/app/layouts/admin/sidebar.tsx b/app/layouts/admin/sidebar.tsx index ae344d7..17fd1c2 100644 --- a/app/layouts/admin/sidebar.tsx +++ b/app/layouts/admin/sidebar.tsx @@ -5,6 +5,11 @@ 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 + } return (
@@ -19,19 +24,19 @@ export const Sidebar = () => { to={url} key={`${group}-${title}`} className={twMerge( - pathname === 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', )} >