Merge branch 'develop'
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { getDirection } from "@/i18n/direction";
|
||||
import { routing } from "@/i18n/routing";
|
||||
import { ClientAppProvider } from "@/providers/ClientAppProvider";
|
||||
import "@/styles/globals.css";
|
||||
import type { Metadata } from "next";
|
||||
import { getLocale, getMessages } from "next-intl/server";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { hasLocale, NextIntlClientProvider } from "next-intl";
|
||||
import { getMessages } from "next-intl/server";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: {
|
||||
@@ -33,11 +36,23 @@ export const viewport = {
|
||||
maximumScale: 1,
|
||||
};
|
||||
|
||||
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const locale = await getLocale();
|
||||
const messages = await getMessages({ locale });
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
params,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
params: Promise<{ locale: string }>;
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
if (!hasLocale(routing.locales, locale)) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const messages = await getMessages();
|
||||
const dir = getDirection(locale);
|
||||
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<html dir={dir} lang={locale} suppressHydrationWarning>
|
||||
<head>
|
||||
{/* Prevent theme flicker before hydration */}
|
||||
<script
|
||||
@@ -55,7 +70,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body className="bg-primary">
|
||||
<body className="bg-background">
|
||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||
<ClientAppProvider>{children}</ClientAppProvider>
|
||||
</NextIntlClientProvider>
|
||||
14
src/app/[locale]/page.tsx
Normal file
14
src/app/[locale]/page.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import ComponentsConteiner from "@/components/ComponentsConteiner";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
export default function Home() {
|
||||
const t = useTranslations("Home");
|
||||
return (
|
||||
<main>
|
||||
<h1>{t("title")}</h1>
|
||||
<p>This project was generated completely offline.</p>
|
||||
<ComponentsConteiner />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import ThemeToggle from "@/components/UI/ThemeToggle";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main>
|
||||
<ThemeToggle />
|
||||
<h1>Offline Next.js Template 🚀</h1>
|
||||
<p>This project was generated completely offline.</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user