import * as React from 'react'; import { Sidebar } from './components/Sidebar'; import { NotificationPanel } from '@/components/shared'; import { cn } from '@/lib/utils'; import { isWordpressEmbed } from '@/lib/wp-integration'; import { useNotifications } from './hooks/useNotifications'; import { ProfileCompletenessBanner } from './components/ProfileCompletenessBanner'; import { LegalConsentBanner } from '@/features/legal/LegalConsentBanner'; interface DashboardLayoutProps { children: React.ReactNode; className?: string; } export function DashboardLayout({ children, className }: DashboardLayoutProps) { const [isPanelOpen, setIsPanelOpen] = React.useState(false); const [currentMessageTypeIndex, setCurrentMessageTypeIndex] = React.useState(0); const { notifications, unreadCount, highestUrgency, messageTypes, markRead, markAllRead, } = useNotifications(); // Cycle through message types every 5 seconds React.useEffect(() => { if (messageTypes.length <= 1) return; const interval = setInterval(() => { setCurrentMessageTypeIndex((prev) => (prev + 1) % messageTypes.length); }, 5000); return () => clearInterval(interval); }, [messageTypes.length]); const currentMessageType = messageTypes[currentMessageTypeIndex]; const handleNotificationClick = () => { setIsPanelOpen((prev) => !prev); }; const handleMarkAsRead = (notificationId: string) => { markRead(notificationId); }; const handleMarkAllRead = () => { markAllRead(); }; // In wp-admin the SPA mounts inside #root which has // `height: calc(100vh - 32px); overflow: hidden` (see admin-layout.css) // and admin-layout.css forces every #root descendant to `height: 100%`, // so we just take 100% here and let the cascade do the work. Standalone // CP has no such ancestor cap and needs its own h-screen. const isWp = isWordpressEmbed(); return (