File tree Expand file tree Collapse file tree 9 files changed +17
-11
lines changed
Expand file tree Collapse file tree 9 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 11import { SignOutButton } from '@clerk/nextjs' ;
22import { getTranslations , setRequestLocale } from 'next-intl/server' ;
3- import Link from 'next/link' ;
43import { LocaleSwitcher } from '@/components/LocaleSwitcher' ;
4+ import { Link } from '@/libs/I18nNavigation' ;
55import { BaseTemplate } from '@/templates/BaseTemplate' ;
66
77export default async function DashboardLayout ( props : {
Original file line number Diff line number Diff line change 11import { getTranslations , setRequestLocale } from 'next-intl/server' ;
2- import Link from 'next/link' ;
32import { DemoBanner } from '@/components/DemoBanner' ;
43import { LocaleSwitcher } from '@/components/LocaleSwitcher' ;
4+ import { Link } from '@/libs/I18nNavigation' ;
55import { BaseTemplate } from '@/templates/BaseTemplate' ;
66
77export default async function Layout ( props : {
Original file line number Diff line number Diff line change 11import type { Metadata } from 'next' ;
22import { getTranslations , setRequestLocale } from 'next-intl/server' ;
33import Image from 'next/image' ;
4- import Link from 'next/link ' ;
4+ import { Link } from '@/libs/I18nNavigation ' ;
55
66type IPortfolioProps = {
77 params : Promise < { locale : string } > ;
Original file line number Diff line number Diff line change 22
33import { zodResolver } from '@hookform/resolvers/zod' ;
44import { useTranslations } from 'next-intl' ;
5- import { useRouter } from 'next/navigation' ;
65import { useForm } from 'react-hook-form' ;
6+ import { useRouter } from '@/libs/I18nNavigation' ;
77import { CounterValidation } from '@/validations/CounterValidation' ;
88
99export const CounterForm = ( ) => {
Original file line number Diff line number Diff line change 1- import Link from 'next/link ' ;
1+ import { Link } from '@/libs/I18nNavigation ' ;
22
33export const DemoBanner = ( ) => (
44 < div className = "sticky top-0 z-50 bg-gray-900 p-4 text-center text-lg font-semibold text-gray-100 [&_a]:text-fuchsia-500 [&_a:hover]:text-indigo-500" >
Original file line number Diff line number Diff line change 22
33import type { ChangeEventHandler } from 'react' ;
44import { useLocale } from 'next-intl' ;
5- import { useRouter } from 'next/navigation' ;
6- import { usePathname } from '@/libs/I18nNavigation' ;
5+ import { usePathname , useRouter } from '@/libs/I18nNavigation' ;
76import { routing } from '@/libs/I18nRouting' ;
87
98export const LocaleSwitcher = ( ) => {
@@ -12,8 +11,14 @@ export const LocaleSwitcher = () => {
1211 const locale = useLocale ( ) ;
1312
1413 const handleChange : ChangeEventHandler < HTMLSelectElement > = ( event ) => {
15- router . push ( `/${ event . target . value } ${ pathname } ` ) ;
16- router . refresh ( ) ; // Ensure the page takes the new locale into account related to the issue #395
14+ const newLocale = event . target . value ;
15+
16+ if ( newLocale === locale ) {
17+ return ;
18+ }
19+
20+ const { search } = window . location ;
21+ router . push ( `${ pathname } ${ search } ` , { locale : newLocale , scroll : false } ) ;
1722 } ;
1823
1924 return (
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export const Sponsors = () => (
8181 < td className = "border-2 border-gray-300 p-3" >
8282 < a href = "https://posthog.com/?utm_source=github& utm_medium = sponsorship & utm_campaign = next - js - boilerplate " >
8383 < Image
84- src = "https://posthog.com/brand /posthog-logo.svg"
84+ src = "/assets/images /posthog-logo.svg"
8585 alt = "PostHog"
8686 width = { 260 }
8787 height = { 224 }
Original file line number Diff line number Diff line change 11import { createNavigation } from 'next-intl/navigation' ;
22import { routing } from './I18nRouting' ;
33
4- export const { usePathname } = createNavigation ( routing ) ;
4+ export const { Link , usePathname, useRouter } = createNavigation ( routing ) ;
You can’t perform that action at this time.
0 commit comments