Refactor variable names for clarity in NavigationDrawerItemForObjectMetadataItem
- Updated variable names to improve readability and maintainability, changing `isOnRecordShowPage` to `isOnObjectRecordShowPage` and `isOnIndexPage` to `isOnObjectIndexPage`. - Enhanced the logic for determining the current path matching object metadata, contributing to clearer navigation handling within the component.
This commit is contained in:
+5
-4
@@ -98,18 +98,19 @@ export const NavigationDrawerItemForObjectMetadataItem = ({
|
||||
const activeNavigationItem = useAtomStateValue(activeNavigationItemState);
|
||||
const setActiveNavigationItem = useSetAtomState(activeNavigationItemState);
|
||||
|
||||
const isOnRecordShowPage = matchesRecordShowPathForObject(
|
||||
const isOnObjectRecordShowPage = matchesRecordShowPathForObject(
|
||||
currentPath,
|
||||
objectMetadataItem.nameSingular,
|
||||
);
|
||||
|
||||
const isOnIndexPage =
|
||||
const isOnObjectIndexPage =
|
||||
currentPath ===
|
||||
getAppPath(AppPath.RecordIndexPage, {
|
||||
objectNamePlural: objectMetadataItem.namePlural,
|
||||
});
|
||||
|
||||
const isCurrentPathMatchingObject = isOnIndexPage || isOnRecordShowPage;
|
||||
const isCurrentPathMatchingObject =
|
||||
isOnObjectIndexPage || isOnObjectRecordShowPage;
|
||||
|
||||
const shouldUseExplicitActiveItem =
|
||||
isDefined(activeNavigationItem) &&
|
||||
@@ -131,7 +132,7 @@ export const NavigationDrawerItemForObjectMetadataItem = ({
|
||||
|
||||
const isActiveByUrl =
|
||||
matchesNavigationMenuItemLink ||
|
||||
(isObject && isOnRecordShowPage) ||
|
||||
(isObject && isOnObjectRecordShowPage) ||
|
||||
(!hasCustomLink && isCurrentPathMatchingObject);
|
||||
|
||||
const isActive =
|
||||
|
||||
Reference in New Issue
Block a user