NeahNew/app/layout.tsx
2025-05-06 22:06:15 +02:00

51 lines
1.5 KiB
TypeScript

import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { headers } from "next/headers";
import { getServerSession } from "next-auth/next";
import { authOptions } from "@/app/api/auth/options";
import { Providers } from "@/components/providers";
import { LayoutWrapper } from "@/components/layout/layout-wrapper";
import { warmupRedisCache } from '@/lib/redis';
const inter = Inter({ subsets: ["latin"] });
// Warm up Redis connection during app initialization
warmupRedisCache().catch(console.error);
export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
const session = await getServerSession(authOptions);
const headersList = await headers();
const pathname = headersList.get("x-pathname") || "";
const isSignInPage = pathname === "/signin";
return (
<html lang="fr">
<head>
<script dangerouslySetInnerHTML={{
__html: `
// Disable React DevTools in production
if (typeof window !== 'undefined' && typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__ === 'object') {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function() {};
}
`
}} />
</head>
<body className={inter.className}>
<Providers>
<LayoutWrapper
isSignInPage={isSignInPage}
isAuthenticated={!!session}
>
{children}
</LayoutWrapper>
</Providers>
</body>
</html>
);
}