[dyad] Fixing a client/server component error - wrote 2 file(s)
This commit is contained in:
@@ -1,11 +1,8 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Geist, Geist_Mono } from "next/font/google";
|
import { Geist, Geist_Mono } from "next/font/google";
|
||||||
import "../globals.css";
|
import "../globals.css";
|
||||||
import { ThemeProvider } from "@/components/theme-provider";
|
|
||||||
import { Toaster } from "@/components/ui/sonner";
|
|
||||||
import { Footer } from "@/components/footer";
|
|
||||||
import { I18nProviderClient } from "@/lib/i18n/client";
|
|
||||||
import { getI18n } from "@/lib/i18n/server";
|
import { getI18n } from "@/lib/i18n/server";
|
||||||
|
import { Providers } from "@/components/providers";
|
||||||
|
|
||||||
const geistSans = Geist({
|
const geistSans = Geist({
|
||||||
variable: "--font-geist-sans",
|
variable: "--font-geist-sans",
|
||||||
@@ -37,18 +34,9 @@ export default function RootLayout({
|
|||||||
<body
|
<body
|
||||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||||
>
|
>
|
||||||
<I18nProviderClient locale={locale}>
|
<Providers locale={locale}>
|
||||||
<ThemeProvider
|
{children}
|
||||||
attribute="class"
|
</Providers>
|
||||||
defaultTheme="system"
|
|
||||||
enableSystem
|
|
||||||
disableTransitionOnChange
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
<Footer />
|
|
||||||
<Toaster />
|
|
||||||
</ThemeProvider>
|
|
||||||
</I18nProviderClient>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
29
src/components/providers.tsx
Normal file
29
src/components/providers.tsx
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ThemeProvider } from "@/components/theme-provider";
|
||||||
|
import { I18nProviderClient } from "@/lib/i18n/client";
|
||||||
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
|
import { Footer } from "@/components/footer";
|
||||||
|
|
||||||
|
export function Providers({
|
||||||
|
children,
|
||||||
|
locale,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
locale: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<I18nProviderClient locale={locale}>
|
||||||
|
<ThemeProvider
|
||||||
|
attribute="class"
|
||||||
|
defaultTheme="system"
|
||||||
|
enableSystem
|
||||||
|
disableTransitionOnChange
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<Footer />
|
||||||
|
<Toaster />
|
||||||
|
</ThemeProvider>
|
||||||
|
</I18nProviderClient>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user