Skip to content

Commit

Permalink
fix: allow to translate collapsible navigation group
Browse files Browse the repository at this point in the history
  • Loading branch information
dziraf committed Nov 30, 2023
1 parent 5536980 commit b2cf2cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/frontend/hooks/use-navigation-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useLocation, useNavigate } from 'react-router'
/* eslint-disable no-param-reassign */
import type {
IconProps,
NavigationElementProps,
NavigationElementWithChildrenProps,
NavigationProps,
} from '@adminjs/design-system'
Expand Down Expand Up @@ -53,11 +52,12 @@ export function useNavigationResources(
if (!resource.navigation || resource.navigation.name === null) {
memo[key] = enrichResource(resource, resource.navigation?.icon)
} else if (memo[key] && memo[key].elements && resource.navigation?.name) {
(memo[key].elements as Array<NavigationElementProps>).push(enrichResource(resource))
memo[key].label = translateLabel(resource.navigation?.name)
memo[key].elements.push(enrichResource(resource))
} else {
memo[key] = {
elements: [enrichResource(resource)],
label: resource.navigation?.name,
label: translateLabel(resource.navigation?.name),
icon: resource.navigation?.icon,
onClick: (): void => setOpenElements({
...openElements,
Expand Down

0 comments on commit b2cf2cb

Please sign in to comment.