- Make GoogleOAuthProvider conditional in layout.tsx (only render if clientId exists) - Add hasGoogleAuth and hasFacebookAuth flags in login page - Conditionally render OAuth buttons and section only when configured - Add fallback message when OAuth is not configured - Prevents "Missing required parameter client_id" error when NEXT_PUBLIC_GOOGLE_CLIENT_ID is not set This allows the app to run without OAuth credentials configured, making deployment easier when OAuth is not yet set up. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
import type { Metadata } from "next";
|
|
import "./globals.css";
|
|
import { AuthProvider } from "@/contexts/AuthContext";
|
|
import { Toaster } from "react-hot-toast";
|
|
import LayoutClient from "./layout-client";
|
|
import { GoogleOAuthProvider } from "@react-oauth/google";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Thé Tip Top - Jeu Concours",
|
|
description: "Participez au grand jeu-concours Thé Tip Top et gagnez des lots exceptionnels ! 100% de tickets gagnants.",
|
|
keywords: "thé, concours, jeu, tip top, nice, gain, lot, infuseur, coffret",
|
|
authors: [{ name: "Thé Tip Top" }],
|
|
icons: {
|
|
icon: [
|
|
{ url: '/favicon.svg', type: 'image/svg+xml' },
|
|
{ url: '/icon.svg', type: 'image/svg+xml' },
|
|
{ url: '/logos/logo.svg', type: 'image/svg+xml' },
|
|
],
|
|
shortcut: '/favicon.svg',
|
|
apple: '/logos/logo.svg',
|
|
},
|
|
openGraph: {
|
|
title: "Thé Tip Top - Jeu Concours",
|
|
description: "Participez au grand jeu-concours et gagnez des lots exceptionnels !",
|
|
type: "website",
|
|
locale: "fr_FR",
|
|
images: [
|
|
{
|
|
url: '/logos/logo.svg',
|
|
width: 1200,
|
|
height: 630,
|
|
alt: 'Thé Tip Top Logo',
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
const googleClientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || '';
|
|
|
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const content = (
|
|
<AuthProvider>
|
|
<LayoutClient>{children}</LayoutClient>
|
|
</AuthProvider>
|
|
);
|
|
|
|
return (
|
|
<html lang="fr">
|
|
<body className="min-h-screen flex flex-col bg-gray-50">
|
|
{googleClientId ? (
|
|
<GoogleOAuthProvider clientId={googleClientId}>
|
|
{content}
|
|
</GoogleOAuthProvider>
|
|
) : (
|
|
content
|
|
)}
|
|
<Toaster
|
|
position="top-right"
|
|
toastOptions={{
|
|
duration: 4000,
|
|
style: {
|
|
background: '#fff',
|
|
color: '#333',
|
|
},
|
|
success: {
|
|
iconTheme: {
|
|
primary: '#10B981',
|
|
secondary: '#fff',
|
|
},
|
|
},
|
|
error: {
|
|
iconTheme: {
|
|
primary: '#EF4444',
|
|
secondary: '#fff',
|
|
},
|
|
},
|
|
}}
|
|
/>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|