66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
import Navbar from '../components/Navbar';
|
|
import Footer from '../components/Footer';
|
|
import { Providers } from '../components/Providers'; // <-- L'astuce est ici !
|
|
import { getSiteSettings } from '../lib/settings';
|
|
import { Metadata } from 'next';
|
|
import { Inter, Playfair_Display } from 'next/font/google';
|
|
import './globals.css';
|
|
|
|
const inter = Inter({
|
|
subsets: ['latin'],
|
|
variable: '--font-inter',
|
|
display: 'swap',
|
|
});
|
|
|
|
const playfair = Playfair_Display({
|
|
subsets: ['latin'],
|
|
variable: '--font-playfair',
|
|
display: 'swap',
|
|
});
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const settings = await getSiteSettings();
|
|
return {
|
|
metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'),
|
|
title: `${settings.siteName} - L'Annuaire 2.0`,
|
|
description: settings.siteSlogan || "Découvrez les pépites de l'écosystème africain.",
|
|
alternates: {
|
|
canonical: '/',
|
|
},
|
|
icons: {
|
|
icon: '/favicon.png', // Le favicon est géré proprement ici maintenant
|
|
},
|
|
};
|
|
}
|
|
|
|
const isDev = process.env.NEXT_PUBLIC_APP_ENV === 'development';
|
|
const devBrandOverride: React.CSSProperties | undefined = isDev ? {
|
|
'--color-brand-50': '#fef2f2',
|
|
'--color-brand-100': '#fee2e2',
|
|
'--color-brand-200': '#fecaca',
|
|
'--color-brand-500': '#ef4444',
|
|
'--color-brand-600': '#dc2626',
|
|
'--color-brand-700': '#b91c1c',
|
|
'--color-brand-900': '#7f1d1d',
|
|
} as React.CSSProperties : undefined;
|
|
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const settings = await getSiteSettings();
|
|
|
|
return (
|
|
<html lang="fr" className={`${inter.variable} ${playfair.variable}`} style={devBrandOverride} suppressHydrationWarning>
|
|
<body className="bg-gray-50 text-gray-900 antialiased min-h-screen flex flex-col font-sans" suppressHydrationWarning>
|
|
<Providers>
|
|
<Navbar settings={settings} />
|
|
<main className="flex-grow">
|
|
{children}
|
|
</main>
|
|
<Footer settings={settings} />
|
|
</Providers>
|
|
</body>
|
|
</html>
|
|
);
|
|
} |