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