From 6d8554c32ad4f810938f04df19a54f7515d8fbfe Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sat, 14 Mar 2026 16:32:28 +0330 Subject: [PATCH] fix active sidebar item --- src/shared/SideBar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/SideBar.tsx b/src/shared/SideBar.tsx index 590608b..3abbea0 100644 --- a/src/shared/SideBar.tsx +++ b/src/shared/SideBar.tsx @@ -20,8 +20,10 @@ const SideBar: FC = () => { const { openSidebar, setOpenSidebar, hasSubMenu, setSubMenuName, setSubtMenu, subMenuName } = useSharedStore() const location = useLocation() - const isActive = (name: string) => { - return window.location.href.includes(name) + const isActive = (path: string) => { + const pathname = location.pathname + if (path === '/') return pathname === '/' + return pathname === path || pathname.startsWith(path + '/') } useEffect(() => {