reason: locale removed from url
This commit is contained in:
@@ -222,7 +222,7 @@ const MenuIndex = () => {
|
||||
|
||||
|
||||
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">
|
||||
<SearchBox value={search} placeholder={tCommon('SearchPlaceholder')} onChange={updateSearch} />
|
||||
<HorizontalScrollView className="w-full noscrollbar mt-4! py-4!">
|
||||
@@ -1,26 +1,24 @@
|
||||
import { Metadata } from "next";
|
||||
import "../globals.css";
|
||||
import "./globals.css";
|
||||
import { ReactQueryProvider } from "@/components/providers/ReactQueryProvider";
|
||||
import { notFound } from "next/navigation";
|
||||
import i18nConfig from "../../../i18nConfig";
|
||||
import i18nConfig from "../../i18nConfig";
|
||||
import initTranslations from '@/lib/i18n';
|
||||
import TranslationsProvider from "@/components/utils/TranslationsProdiver";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Dashboard',
|
||||
description: 'Webapp dashboard'
|
||||
description: 'Webapp dashboard',
|
||||
}
|
||||
|
||||
const i18nNamespaces = ['common', 'menu', 'orders', 'auth'];
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
params,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
params: Promise<{ locale: string }>
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
const locale = "fa";
|
||||
if (!i18nConfig.locales.includes(locale)) {
|
||||
notFound();
|
||||
}
|
||||
@@ -28,9 +26,12 @@ export default async function RootLayout({
|
||||
|
||||
return (
|
||||
|
||||
<html lang={locale} className="h-svh overflow-hidden">
|
||||
<html
|
||||
lang='fa'
|
||||
dir='rtl'
|
||||
className="h-svh overflow-hidden">
|
||||
<body
|
||||
dir={locale === 'fa' ? 'rtl' : 'ltr'}
|
||||
|
||||
className={`antialiased bg-background h-svh overflow-hidden`}
|
||||
>
|
||||
<ReactQueryProvider>
|
||||
@@ -12,7 +12,7 @@ const HomeIcon: React.FC<Props> = ({ ...props }) => {
|
||||
fill="none"
|
||||
{...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>
|
||||
</svg>
|
||||
);
|
||||
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
import { i18nRouter } from 'next-i18n-router';
|
||||
import { NextRequest } from 'next/server';
|
||||
import i18nConfig from '../i18nConfig';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function middleware(request: NextRequest) {
|
||||
return i18nRouter(request, i18nConfig);
|
||||
|
||||
}
|
||||
|
||||
// only applies this middleware to files in the app directory
|
||||
|
||||
Reference in New Issue
Block a user