import React from 'react' import { useLocation } from '@tanstack/react-router' import { BottomNavigation } from './BottomNavigation' import { FloatingCartBar } from './FloatingCartBar' import { Sidebar } from './shell/Sidebar' import { Topbar } from './shell/Topbar' interface AppLayoutProps { children: React.ReactNode showCartBar?: boolean isFlashDelivery?: boolean hideShell?: boolean } // Routes where the full shell (sidebar/topbar/bottom nav) should be hidden const hideShellRoutes = ['/login', '/register', '/checkout', '/home/checkout', '/flash/checkout'] export function AppLayout({ children, showCartBar = true, isFlashDelivery = false, hideShell = false, }: AppLayoutProps) { const location = useLocation() const currentPath = location.pathname const shouldHideShell = hideShell || hideShellRoutes.some((route) => currentPath === route || currentPath.startsWith(`${route}/`)) // On mobile the cart bar replaces the old floating pill const shouldShowCartBar = showCartBar && !shouldHideShell if (shouldHideShell) { return
{children}
} return (
{/* Desktop rail */} {/* Top bar with search + cart */} {/* Main content */}
{children}
{/* Cart slide-over (desktop) / bottom bar (mobile) */} {shouldShowCartBar && } {/* Mobile bottom nav */}
) }