11'use client' ;
22
33import Sidebar from '@node-core/ui-components/Containers/Sidebar' ;
4- import { usePathname } from 'next/navigation' ;
5- import { useLocale , useTranslations } from 'next-intl' ;
4+ import { useTranslations } from 'next-intl' ;
65import { useRef } from 'react' ;
76
87import Link from '#site/components/Link' ;
9- import { useClientContext } from '#site/hooks/client' ;
10- import { useNavigationState } from '#site/hooks/client' ;
8+ import { useClientContext , useNavigationState } from '#site/hooks/client' ;
119import { useSiteNavigation } from '#site/hooks/generic' ;
12- import { useRouter } from '#site/navigation.mjs' ;
10+ import { useRouter , usePathname } from '#site/navigation.mjs' ;
1311
1412import type { NavigationKeys } from '#site/types' ;
1513import type { RichTranslationValues } from 'next-intl' ;
@@ -23,15 +21,12 @@ type WithSidebarProps = {
2321const WithSidebar : FC < WithSidebarProps > = ( { navKeys, context, ...props } ) => {
2422 const { getSideNavigation } = useSiteNavigation ( ) ;
2523 const pathname = usePathname ( ) ! ;
26- const locale = useLocale ( ) ;
2724 const t = useTranslations ( ) ;
2825 const { push } = useRouter ( ) ;
2926 const { frontmatter } = useClientContext ( ) ;
3027 const sidebarRef = useRef < HTMLElement > ( null ) ;
3128 const sideNavigation = getSideNavigation ( navKeys , context ) ;
3229
33- const localePathname = pathname . replace ( `/${ locale } ` , '' ) ;
34-
3530 // Preserve sidebar scroll position across navigations
3631 useNavigationState ( 'sidebar' , sidebarRef ) ;
3732
@@ -49,7 +44,7 @@ const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context, ...props }) => {
4944 < Sidebar
5045 ref = { sidebarRef }
5146 groups = { mappedSidebarItems }
52- pathname = { localePathname }
47+ pathname = { pathname }
5348 title = { t ( 'components.common.sidebar.title' ) }
5449 placeholder = { frontmatter ?. title }
5550 onSelect = { push }
0 commit comments