reason: locale removed from url
This commit is contained in:
@@ -222,7 +222,7 @@ const MenuIndex = () => {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-4 items-center pt-8" ref={wrapperRef}>
|
<div className="flex flex-col gap-4 items-center pt-8 mb-8" ref={wrapperRef}>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<SearchBox value={search} placeholder={tCommon('SearchPlaceholder')} onChange={updateSearch} />
|
<SearchBox value={search} placeholder={tCommon('SearchPlaceholder')} onChange={updateSearch} />
|
||||||
<HorizontalScrollView className="w-full noscrollbar mt-4! py-4!">
|
<HorizontalScrollView className="w-full noscrollbar mt-4! py-4!">
|
||||||
@@ -1,26 +1,24 @@
|
|||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
import "../globals.css";
|
import "./globals.css";
|
||||||
import { ReactQueryProvider } from "@/components/providers/ReactQueryProvider";
|
import { ReactQueryProvider } from "@/components/providers/ReactQueryProvider";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import i18nConfig from "../../../i18nConfig";
|
import i18nConfig from "../../i18nConfig";
|
||||||
import initTranslations from '@/lib/i18n';
|
import initTranslations from '@/lib/i18n';
|
||||||
import TranslationsProvider from "@/components/utils/TranslationsProdiver";
|
import TranslationsProvider from "@/components/utils/TranslationsProdiver";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'Dashboard',
|
title: 'Dashboard',
|
||||||
description: 'Webapp dashboard'
|
description: 'Webapp dashboard',
|
||||||
}
|
}
|
||||||
|
|
||||||
const i18nNamespaces = ['common', 'menu', 'orders', 'auth'];
|
const i18nNamespaces = ['common', 'menu', 'orders', 'auth'];
|
||||||
|
|
||||||
export default async function RootLayout({
|
export default async function RootLayout({
|
||||||
children,
|
children,
|
||||||
params,
|
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
params: Promise<{ locale: string }>
|
|
||||||
}>) {
|
}>) {
|
||||||
const { locale } = await params;
|
const locale = "fa";
|
||||||
if (!i18nConfig.locales.includes(locale)) {
|
if (!i18nConfig.locales.includes(locale)) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
@@ -28,9 +26,12 @@ export default async function RootLayout({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<html lang={locale} className="h-svh overflow-hidden">
|
<html
|
||||||
|
lang='fa'
|
||||||
|
dir='rtl'
|
||||||
|
className="h-svh overflow-hidden">
|
||||||
<body
|
<body
|
||||||
dir={locale === 'fa' ? 'rtl' : 'ltr'}
|
|
||||||
className={`antialiased bg-background h-svh overflow-hidden`}
|
className={`antialiased bg-background h-svh overflow-hidden`}
|
||||||
>
|
>
|
||||||
<ReactQueryProvider>
|
<ReactQueryProvider>
|
||||||
@@ -12,7 +12,7 @@ const HomeIcon: React.FC<Props> = ({ ...props }) => {
|
|||||||
fill="none"
|
fill="none"
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<path d="M17.79 22.75H6.21c-2.74 0-4.96-2.23-4.96-4.97v-7.41c0-1.36.84-3.07 1.92-3.91l5.39-4.2C10.18 1 12.77.94 14.45 2.12l6.18 4.33c1.19.83 2.12 2.61 2.12 4.06v7.28c0 2.73-2.22 4.96-4.96 4.96ZM9.48 3.46-3.46v-7.28c0-.96-.69-2.29-1.48-2.83l-6.18-4.33c-1.14-.8-3.02-.76-4.11.09Z"></path>
|
<path d="M17.79 22.75H6.21c-2.74 0-4.96-2.23-4.96-4.97v-7.41c0-1.36.84-3.07 1.92-3.91l5.39-4.2C10.18 1 12.77.94 14.45 2.12l6.18 4.33c1.19.83 2.12 2.61 2.12 4.06v7.28c0 2.73-2.22 4.96-4.96 4.96Z" />
|
||||||
<path d="M12 18.75c-.41 0-.75-.34-.75-.75v-3c0-.41.34-.75.75-.75s.75.34.75.75v3c0 .41-.34.75-.75.75Z"></path>
|
<path d="M12 18.75c-.41 0-.75-.34-.75-.75v-3c0-.41.34-.75.75-.75s.75.34.75.75v3c0 .41-.34.75-.75.75Z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-3
@@ -1,9 +1,8 @@
|
|||||||
import { i18nRouter } from 'next-i18n-router';
|
|
||||||
import { NextRequest } from 'next/server';
|
import { NextRequest } from 'next/server';
|
||||||
import i18nConfig from '../i18nConfig';
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export function middleware(request: NextRequest) {
|
export function middleware(request: NextRequest) {
|
||||||
return i18nRouter(request, i18nConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only applies this middleware to files in the app directory
|
// only applies this middleware to files in the app directory
|
||||||
|
|||||||
Reference in New Issue
Block a user