fix active sidebar item

This commit is contained in:
hamid zarghami
2026-03-14 16:32:28 +03:30
parent 18b9bf820f
commit 6d8554c32a
+4 -2
View File
@@ -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(() => {