Skip to content

Commit 8b2100a

Browse files
fix: active link
1 parent 60be02d commit 8b2100a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

apps/site/components/withProgressionSidebar.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
import ProgressionSidebar from '@node-core/ui-components/Common/ProgressionSidebar';
44
import { usePathname } from 'next/navigation';
5-
import { useTranslations, type RichTranslationValues } from 'next-intl';
5+
import {
6+
useLocale,
7+
useTranslations,
8+
type RichTranslationValues,
9+
} from 'next-intl';
610
import type { FC } from 'react';
711

812
import Link from '@/components/Link';
@@ -21,6 +25,7 @@ const WithProgressionSidebar: FC<WithProgressionSidebarProps> = ({
2125
}) => {
2226
const { getSideNavigation } = useSiteNavigation();
2327
const pathname = usePathname();
28+
const locale = useLocale();
2429
const t = useTranslations();
2530
const { push } = useRouter();
2631
const [[, sidebarNavigation]] = getSideNavigation([navKey], context);
@@ -35,7 +40,7 @@ const WithProgressionSidebar: FC<WithProgressionSidebarProps> = ({
3540
return (
3641
<ProgressionSidebar
3742
groups={mappedProgressionSidebarItems}
38-
pathname={pathname!}
43+
pathname={pathname?.replace(`/${locale}`, '')}
3944
title={t('components.common.sidebar.title')}
4045
onSelect={push}
4146
as={Link}

apps/site/components/withSidebar.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
import Sidebar from '@node-core/ui-components/Containers/Sidebar';
44
import { usePathname } from 'next/navigation';
5-
import { useTranslations, type RichTranslationValues } from 'next-intl';
5+
import {
6+
useLocale,
7+
useTranslations,
8+
type RichTranslationValues,
9+
} from 'next-intl';
610
import type { FC } from 'react';
711

812
import Link from '@/components/Link';
@@ -18,6 +22,7 @@ type WithSidebarProps = {
1822
const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context }) => {
1923
const { getSideNavigation } = useSiteNavigation();
2024
const pathname = usePathname()!;
25+
const locale = useLocale();
2126
const t = useTranslations();
2227
const { push } = useRouter();
2328

@@ -31,7 +36,7 @@ const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context }) => {
3136
return (
3237
<Sidebar
3338
groups={mappedSidebarItems}
34-
pathname={pathname}
39+
pathname={pathname.replace(`/${locale}`, '')}
3540
title={t('components.common.sidebar.title')}
3641
onSelect={value => push(value)}
3742
as={Link}

0 commit comments

Comments
 (0)