'use client' import { Sidebar } from '@/components/Sidebar' import { Header } from '@/components/Header' import { usePathname } from 'next/navigation' import { useAuth } from '@/contexts/AuthContext' import { cn } from '@/lib/utils' import { useEffect } from 'react' import { useRouter } from 'next/navigation' import { MobileHeader, MobileSidebarWrapper } from '@/components/MobileNav' import { MobileBottomNav } from '@/components/MobileBottomNav' import { SecondaryNav } from '@/components/SecondaryNav' function ProtectedLayout({ children }: { children: React.ReactNode }) { const { user, isLoading } = useAuth() const router = useRouter() useEffect(() => { if (!isLoading && !user) { router.push('/login') } }, [isLoading, user, router]) if (!user && isLoading) { return (
) } if (!user) return null return <>{children} } export function LayoutClient({ children }: { children: React.ReactNode }) { const pathname = usePathname() // Pages without sidebar (public pages) const publicPages = ['/', '/login', '/register', '/verify-email', '/forgot-password', '/terms', '/privacy', '/refund', '/pricing'] const isPublicPage = publicPages.includes(pathname) return ( <> {/* Global Background Atmosphere - Synced with Landing */}
{isPublicPage ? ( // Public layout (no sidebar)
{children}
) : ( // App layout (with sidebar)
{/* Desktop Sidebar */}
{/* Mobile Sidebar (Drawer - opens from menu button) */} {/* Main Content Area Container */}
{/* Desktop Header */}
{/* Secondary Nav - Tablet/Small Desktop Only (Full Sidebar Content) */} {/* Mobile Header - FIXED at top - ONLY for Mobile (< md) */}
{/* Main Content - with padding for fixed header and bottom nav on Mobile */}
{children}
{/* Mobile Bottom Navigation - FIXED at bottom - ONLY for Mobile (< md) */}
)} ) }