mirror of
http://88.130.71.182:3000/BlitTech/badoHair_fe.git
synced 2026-06-12 23:23:22 +00:00
only front-end init
This commit is contained in:
@@ -1,33 +1,43 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
// app/layout.tsx
|
||||
'use client';
|
||||
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { LanguageProvider } from "@/contexts/LanguageContext";
|
||||
import { AdminProvider } from "@/contexts/AdminContext";
|
||||
import { CartProvider } from "@/contexts/CartContext";
|
||||
import CartDrawer from "@/components/CartDrawer";
|
||||
import "./globals.css";
|
||||
import Header from "@/components/Header";
|
||||
import Footer from "@/components/Footer";
|
||||
import { Toaster } from "sonner";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const pathname = usePathname();
|
||||
|
||||
// Vérifier si on est sur une route admin
|
||||
const isAdminRoute = pathname?.startsWith('/admin');
|
||||
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col">{children}</body>
|
||||
<html>
|
||||
<body>
|
||||
<LanguageProvider>
|
||||
<AdminProvider>
|
||||
<CartProvider>
|
||||
<Toaster position="top-right" richColors />
|
||||
|
||||
{/* Afficher Header seulement si ce n'est pas l'admin */}
|
||||
{!isAdminRoute && <Header />}
|
||||
{!isAdminRoute && <CartDrawer />}
|
||||
|
||||
{children}
|
||||
|
||||
{/* Afficher Footer seulement si ce n'est pas l'admin */}
|
||||
{!isAdminRoute && <Footer />}
|
||||
|
||||
</CartProvider>
|
||||
</AdminProvider>
|
||||
</LanguageProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user