From 17df35102d91fc9e17b25cbb57ab8369a790304c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Sun, 22 Mar 2026 10:18:13 +0300 Subject: [PATCH] =?UTF-8?q?FormView,=20FormEdit=20ve=20FormNew=20i=C3=A7in?= =?UTF-8?q?=20MenuIcon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/utils/hooks/useCurrentMenuIcon.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/src/utils/hooks/useCurrentMenuIcon.tsx b/ui/src/utils/hooks/useCurrentMenuIcon.tsx index 2dad5e4..f629226 100644 --- a/ui/src/utils/hooks/useCurrentMenuIcon.tsx +++ b/ui/src/utils/hooks/useCurrentMenuIcon.tsx @@ -4,6 +4,16 @@ import { FaUser } from 'react-icons/fa' import navigationIcon from '@/proxy/menus/navigation-icon.config' import { navigationTreeToFlat } from '@/utils/navigation' +const extractListFormCode = (path: string): string | null => { + const p = (path ?? '').toLowerCase() + + // /admin/form//..., /admin/list//..., /admin/chart//..., /admin/pivot//... + let m = p.match(/\/admin\/(?:list|form|chart|pivot)\/([^/?#]+)/) + if (m?.[1]) return m[1] + + return null +} + export function useCurrentMenuIcon(className = 'w-6 h-6'): JSX.Element { const mainMenu = useStoreState((state) => state.abpConfig.menu.mainMenu) const location = useLocation() @@ -18,6 +28,12 @@ export function useCurrentMenuIcon(className = 'w-6 h-6'): JSX.Element { // Exact match if (currentPath.startsWith(menuPath)) return true + // Form/list/chart/pivot routes can include extra segments (e.g. /:id, /edit). + // Match by listFormCode extracted from both paths. + const currentCode = extractListFormCode(currentPath) + const menuCode = extractListFormCode(menuPath) + if (currentCode && menuCode && currentCode === menuCode) return true + // Extract the form code (e.g., "App.Definitions.Program" from path) const menuFormCode = menuPath.split('/').pop() || ''