Spaces:
Running
Running
axeronis
fix: funnel generation error (remove invalid custom_fields), remove Nova floating widget
e454398 Download frontend/components/layout/LayoutClient.tsx from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 5.04 kB
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/frontend/components/layout/LayoutClient.tsx
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/frontend/components/layout/LayoutClient.tsx
-
curl -L -o LayoutClient.tsx https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/frontend/components/layout/LayoutClient.tsx
5.04 kB
| '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 ( | |
| <div className="flex h-screen items-center justify-center bg-background"> | |
| <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"></div> | |
| </div> | |
| ) | |
| } | |
| 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 */} | |
| <div className="fixed inset-0 z-0 pointer-events-none overflow-hidden bg-[#050510]"> | |
| <div className="absolute top-[-10%] right-[-5%] w-[60%] h-[60%] bg-gradient-to-b from-cyan-500/10 via-emerald-500/5 to-transparent blur-[50px] rounded-full" /> | |
| <div className="absolute bottom-[-10%] left-[-10%] w-[60%] h-[60%] bg-gradient-to-t from-indigo-600/10 via-purple-600/5 to-transparent blur-[50px] rounded-full" /> | |
| </div> | |
| {isPublicPage ? ( | |
| // Public layout (no sidebar) | |
| <div className="relative z-10">{children}</div> | |
| ) : ( | |
| // App layout (with sidebar) | |
| <ProtectedLayout> | |
| <div className="flex h-[100dvh] md:h-screen lg:h-screen relative text-white overflow-hidden"> | |
| {/* Desktop Sidebar */} | |
| <div className="hidden lg:flex h-full relative z-20 w-72 shrink-0"> | |
| <Sidebar /> | |
| </div> | |
| {/* Mobile Sidebar (Drawer - opens from menu button) */} | |
| <MobileSidebarWrapper> | |
| <Sidebar /> | |
| </MobileSidebarWrapper> | |
| {/* Main Content Area Container */} | |
| <div className="flex-1 flex flex-col h-full overflow-hidden min-w-0 relative"> | |
| {/* Desktop Header */} | |
| <Header /> | |
| {/* Secondary Nav - Tablet/Small Desktop Only (Full Sidebar Content) */} | |
| <SecondaryNav /> | |
| {/* Mobile Header - FIXED at top - ONLY for Mobile (< md) */} | |
| <div className="md:hidden contents"> | |
| <MobileHeader /> | |
| </div> | |
| {/* Main Content - with padding for fixed header and bottom nav on Mobile */} | |
| <main | |
| className={cn( | |
| "flex-1 w-full md:pt-0 md:pb-0 overflow-x-hidden", | |
| "overflow-y-auto min-h-0" | |
| )} | |
| style={{ | |
| // paddingTop: pathname?.startsWith('/chats') ? '0px' : 'var(--header-height-mobile)', | |
| // paddingBottom: 'var(--footer-height-mobile)' | |
| }} | |
| > | |
| <div | |
| className="w-full h-full" | |
| style={{ | |
| paddingTop: 'var(--header-height-mobile)', | |
| paddingBottom: 'var(--footer-height-mobile)' | |
| }} | |
| > | |
| {children} | |
| </div> | |
| </main> | |
| {/* Mobile Bottom Navigation - FIXED at bottom - ONLY for Mobile (< md) */} | |
| <div className="md:hidden contents"> | |
| <MobileBottomNav /> | |
| </div> | |
| </div> | |
| </div> | |
| </ProtectedLayout> | |
| )} | |
| </> | |
| ) | |
| } | |