"use client"; import { ProductsTab, ReviewsTab } from "@/components/organisms/manager"; import { useAuth } from "@/lib/auth-context"; import { useManager } from "@/lib/manager-context"; import Link from "next/link"; import { useEffect, useRef, useState } from "react"; export default function ManagerPage() { const { user, logout } = useAuth(); const { activeTab, setActiveTab, products } = useManager(); const [dropdownOpen, setDropdownOpen] = useState(false); const dropdownRef = useRef(null); const tabs = [ { id: "products" as const, label: "Menu", icon: "fa-solid fa-utensils", count: products.length, }, { id: "reviews" as const, label: "Reviews", icon: "fa-solid fa-star", count: null, }, ]; useEffect(() => { function handleOutsideClick(e: MouseEvent) { if ( dropdownRef.current && !dropdownRef.current.contains(e.target as Node) ) { setDropdownOpen(false); } } document.addEventListener("mousedown", handleOutsideClick); return () => document.removeEventListener("mousedown", handleOutsideClick); }, []); return (
{/* ── Sidebar (lg+) ── */} {/* ── Main content ── */}
{/* Title */}

{tabs.find((t) => t.id === activeTab)?.label ?? "Manager"}

{activeTab === "products" ? "Manage menu items for your store" : "Customer reviews for your eatery"}

{/* ── Actions: hidden on lg+ (sidebar handles nav there) ── */}
{/* sm–lg: inline icon+label buttons */}
{tabs.map((tab) => ( ))} Finance Shifts Create Staff Home
{/* < sm: hamburger → dropdown */}
{dropdownOpen && (
{/* Tab buttons */} {tabs.map((tab) => ( ))}
{/* Navigation links */} setDropdownOpen(false)} className="flex items-center gap-2.5 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-primary) no-underline transition hover:bg-(--color-accent-light)" > Finance setDropdownOpen(false)} className="flex items-center gap-2.5 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition hover:bg-(--color-border-light)" > Shifts setDropdownOpen(false)} className="flex items-center gap-2.5 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition hover:bg-(--color-border-light)" > Create Staff setDropdownOpen(false)} className="flex items-center gap-2.5 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition hover:bg-(--color-border-light)" > Home
)}
{/* ── Desktop actions (lg+): sidebar handles nav, just show shortcut ── */}
Financial Analytics Create Staff Home
{activeTab === "products" && } {activeTab === "reviews" && }
); }