@@ -34,7 +34,10 @@ import {
34
34
} from "../../../../../../shell/components/AppSidebar" ;
35
35
import { NavTree , TreeItem } from "../../../../../../shell/components/NavTree" ;
36
36
import { useGetCurrentUserRolesQuery } from "../../../../../../shell/services/accounts" ;
37
- import { useGetContentNavItemsQuery } from "../../../../../../shell/services/instance" ;
37
+ import {
38
+ useGetContentNavItemsQuery ,
39
+ useGetContentItemQuery ,
40
+ } from "../../../../../../shell/services/instance" ;
38
41
import noSearchResults from "../../../../../../../public/images/noSearchResults.svg" ;
39
42
import { CreateContentItemDialog } from "../../../../../../shell/components/CreateContentItemDialog" ;
40
43
import {
@@ -99,6 +102,10 @@ export const ContentNav = () => {
99
102
useGetCurrentUserRolesQuery ( ) ;
100
103
const { data : rawNavData , isError : navItemsError } =
101
104
useGetContentNavItemsQuery ( null , { refetchOnMountOrArgChange : true } ) ;
105
+ const { data : contentItem } = useGetContentItemQuery (
106
+ location . pathname . split ( "/" ) [ 3 ] ,
107
+ { skip : ! location . pathname . split ( "/" ) [ 3 ] }
108
+ ) ;
102
109
103
110
const [ closedNavItems , setClosedNavItems ] = useLocalStorage (
104
111
"zesty:navContentItems:closed" ,
@@ -393,11 +400,24 @@ export const ContentNav = () => {
393
400
) {
394
401
return pathWithoutContentZUID ;
395
402
}
403
+
404
+ /**
405
+ * Checks if the current url has a sibling that exists on the content nav
406
+ * Adds support to multi-lang content items
407
+ */
408
+ if ( ! ! contentItem ?. siblings ) {
409
+ const siblingOnContentNav = Object . values ( contentItem . siblings ) ?. find (
410
+ ( item ) =>
411
+ pathExists ( mappedTree , `${ pathWithoutContentZUID } /${ item } ` )
412
+ ) ;
413
+
414
+ return `${ pathWithoutContentZUID } /${ siblingOnContentNav } ` ;
415
+ }
396
416
}
397
417
398
418
return pathWithContentZUID ;
399
419
}
400
- } , [ location , mappedTree , clippingsZUID ] ) ;
420
+ } , [ location , mappedTree , clippingsZUID , contentItem ] ) ;
401
421
402
422
useEffect ( ( ) => {
403
423
if ( currentUserRolesError ) {
0 commit comments