I see this error with the app, reported by NextJS, please fix it. The er
This commit is contained in:
parent
28430f236e
commit
4698d67c38
|
|
@ -1,6 +1,6 @@
|
|||
import type { Metadata } from 'next';
|
||||
import { PT_Sans } from 'next/font/google';
|
||||
import '../globals.css'; // Adjusted path for globals.css
|
||||
// This layout wraps specific locale pages and sets up providers.
|
||||
import type { Metadata } from 'next'; // Keep for potential locale-specific metadata
|
||||
import '../globals.css'; // Ensure global styles are still imported
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import Header from '@/components/layout/Header';
|
||||
import Footer from '@/components/layout/Footer';
|
||||
|
|
@ -9,26 +9,16 @@ import { ThemeProvider } from '@/components/theme-provider';
|
|||
import { I18nProviderClient } from '@/locales/client';
|
||||
import { getStaticParams } from '@/locales/server';
|
||||
|
||||
const ptSans = PT_Sans({
|
||||
subsets: ['latin'],
|
||||
weight: ['400', '700'],
|
||||
variable: '--font-body',
|
||||
});
|
||||
// PT_Sans is applied globally from src/app/layout.tsx via ptSans.variable on body
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'ToyShare - Share and Rent Toys',
|
||||
description: 'A friendly platform to share and rent toys in your community.',
|
||||
icons: {
|
||||
icon: '/favicon.ico',
|
||||
}
|
||||
};
|
||||
|
||||
// Needed for static generation with dynamic [locale] segment
|
||||
export function generateStaticParams() {
|
||||
return getStaticParams();
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
// Potentially add locale-specific metadata here if needed, or it can merge with root.
|
||||
// export const metadata: Metadata = { ... };
|
||||
|
||||
export default async function LocaleLayout({
|
||||
children,
|
||||
params: { locale }
|
||||
}: Readonly<{
|
||||
|
|
@ -37,31 +27,21 @@ export default function RootLayout({
|
|||
}>) {
|
||||
return (
|
||||
<I18nProviderClient locale={locale}>
|
||||
<html lang={locale} suppressHydrationWarning>
|
||||
<head>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&display=swap" rel="stylesheet" />
|
||||
</head>
|
||||
<body
|
||||
className={cn('min-h-screen bg-background font-body antialiased flex flex-col', ptSans.variable)}
|
||||
suppressHydrationWarning={true}
|
||||
>
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<Header />
|
||||
<main className="flex-grow container mx-auto px-4 py-8">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
<Toaster />
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<div className="flex flex-col min-h-screen"> {/* This div takes on the body's layout role */}
|
||||
<Header />
|
||||
<main className="flex-grow container mx-auto px-4 py-8">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
<Toaster />
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
</I18nProviderClient>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
import type { Metadata } from 'next';
|
||||
import { PT_Sans } from 'next/font/google';
|
||||
import './globals.css';
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import Header from '@/components/layout/Header';
|
||||
import Footer from '@/components/layout/Footer';
|
||||
// Toaster, Header, Footer, ThemeProvider will be handled by the locale layout
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ThemeProvider } from '@/components/theme-provider';
|
||||
|
||||
const ptSans = PT_Sans({
|
||||
subsets: ['latin'],
|
||||
|
|
@ -17,7 +14,7 @@ export const metadata: Metadata = {
|
|||
title: 'ToyShare - Share and Rent Toys',
|
||||
description: 'A friendly platform to share and rent toys in your community.',
|
||||
icons: {
|
||||
icon: '/favicon.ico', // Basic favicon, can be improved
|
||||
icon: '/favicon.ico',
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -33,23 +30,11 @@ export default function RootLayout({
|
|||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&display=swap" rel="stylesheet" />
|
||||
</head>
|
||||
<body
|
||||
className={cn('min-h-screen bg-background font-body antialiased flex flex-col', ptSans.variable)}
|
||||
<body
|
||||
className={cn('bg-background font-body antialiased', ptSans.variable)} // Removed flex flex-col min-h-screen here, will be on a wrapper in locale layout
|
||||
suppressHydrationWarning={true}
|
||||
>
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<Header />
|
||||
<main className="flex-grow container mx-auto px-4 py-8">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
<Toaster />
|
||||
</ThemeProvider>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue