agenda finition
This commit is contained in:
parent
b9ff338920
commit
cdff23c65b
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useSession, signOut } from "next-auth/react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { MainNav } from "@/components/main-nav";
|
||||
@ -28,12 +28,18 @@ export function LayoutWrapper({ children, isSignInPage, isAuthenticated }: Layou
|
||||
const { currentBackground, changeBackground } = useBackgroundImage();
|
||||
const { data: session } = useSession();
|
||||
const pathname = usePathname();
|
||||
const isAgendaPage = pathname?.startsWith('/agenda') || pathname === '/agenda';
|
||||
const [isAgendaPage, setIsAgendaPage] = useState(false);
|
||||
|
||||
// Debug: log pour vérifier le pathname
|
||||
// Détection robuste de la page agenda avec fallback window.location
|
||||
useEffect(() => {
|
||||
console.log('[LayoutWrapper] pathname:', pathname, 'isAgendaPage:', isAgendaPage);
|
||||
}, [pathname, isAgendaPage]);
|
||||
const checkAgendaPage = () => {
|
||||
const currentPath = pathname || (typeof window !== 'undefined' ? window.location.pathname : '');
|
||||
const isAgenda = currentPath?.startsWith('/agenda') || currentPath === '/agenda';
|
||||
setIsAgendaPage(isAgenda);
|
||||
console.log('[LayoutWrapper] pathname:', currentPath, 'isAgendaPage:', isAgenda);
|
||||
};
|
||||
checkAgendaPage();
|
||||
}, [pathname]);
|
||||
|
||||
// Listen for incoming RocketChat calls via WebSocket
|
||||
const { incomingCall, setIncomingCall } = useRocketChatCalls();
|
||||
@ -216,16 +222,26 @@ export function LayoutWrapper({ children, isSignInPage, isAuthenticated }: Layou
|
||||
};
|
||||
}, [isSignInPage, session]);
|
||||
|
||||
// Force background blanc sur body pour la page agenda
|
||||
useEffect(() => {
|
||||
if (isAgendaPage && typeof document !== 'undefined') {
|
||||
document.body.style.backgroundColor = 'white';
|
||||
return () => {
|
||||
document.body.style.backgroundColor = '';
|
||||
};
|
||||
}
|
||||
}, [isAgendaPage]);
|
||||
|
||||
return (
|
||||
<AuthCheck>
|
||||
{!isSignInPage && isAuthenticated && <MainNav />}
|
||||
<div
|
||||
className={isSignInPage ? "min-h-screen" : "min-h-screen"}
|
||||
className={isSignInPage ? "min-h-screen" : isAgendaPage ? "h-screen" : "min-h-screen"}
|
||||
style={
|
||||
isSignInPage
|
||||
? {} // No background style for signin page - let the page component handle it
|
||||
: isAgendaPage
|
||||
? {} // No background for agenda page - it has its own white background
|
||||
? { backgroundColor: 'white' } // Force white background for agenda page
|
||||
: {
|
||||
backgroundImage: `url('${currentBackground}')`,
|
||||
backgroundSize: 'cover',
|
||||
@ -240,9 +256,8 @@ export function LayoutWrapper({ children, isSignInPage, isAuthenticated }: Layou
|
||||
>
|
||||
<main>{children}</main>
|
||||
</div>
|
||||
{/* TEMPORAIRE : Footer masqué uniquement sur la page agenda pour test layout */}
|
||||
{/* Force masquage pour test - pathname: ${pathname}, isAgendaPage: ${isAgendaPage} */}
|
||||
{!isSignInPage && isAuthenticated && !isAgendaPage && pathname !== '/agenda' && <Footer />}
|
||||
{/* Footer masqué sur la page agenda */}
|
||||
{!isSignInPage && isAuthenticated && !isAgendaPage && <Footer />}
|
||||
<Toaster />
|
||||
|
||||
{/* Notifications stack (calls and emails) */}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user