import Link from 'next/link'; import { useAuth } from '@/context/auth-context'; import { useCart } from '@/context/cart-context'; import { useTheme } from '@/context/theme-context'; const MainLayout = ({ children }) => { const { user, isAuthenticated, logout } = useAuth(); const { getItemCount } = useCart(); const { theme, toggleTheme } = useTheme(); const cartItemCount = getItemCount(); return (
{/* Header */}
{/* Logo */} Restaurant {/* Navigation Menu */} {/* User Actions */}
{/* Cart Icon */} {cartItemCount > 0 && ( {cartItemCount} )} {/* Theme Toggle */} {/* Auth Actions */} {isAuthenticated ? (
{/* Dropdown Menu */}
Profile Orders {user?.role === 'admin' && ( Admin Dashboard )} {user?.role === 'staff' && ( Staff Dashboard )}
) : (
Login Register
)}
{/* Main Content */}
{children}
{/* Footer */}
); }; export default MainLayout;