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