diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 718dbdb..cd8b21b 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -190,6 +190,7 @@ const menuItems: MenuItem[] = [ title: 'مدیریت کیف پول', icon: Wallet, path: '/wallet', + exact: true, }, { title: 'شارژ کیف پول', @@ -234,7 +235,14 @@ export const Sidebar = ({ isOpen, onClose }: SidebarProps) => { if (child.exact) { return currentPath === child.path; } - return currentPath.startsWith(child.path); + // For non-exact paths, check if current path starts with child path + // but also ensure it's not a partial match (e.g., /wallet should not match /wallet/credit) + if (currentPath === child.path) { + return true; + } + // Only match if current path starts with child path AND has a slash after it + // This prevents /wallet from matching /wallet/credit + return currentPath.startsWith(child.path + '/'); } return false; });