"use client"; import { usePathname } from "next/navigation"; import { useEffect, useRef } from "react"; import { Icon } from "../Icon"; import { useBadges } from "./AdminBadges"; export function MobileAdminNav({ children }: { children: React.ReactNode }) { const ref = useRef(null); const pathname = usePathname(); useEffect(() => { if (ref.current) ref.current.open = false; }, [pathname]); const badges = useBadges(); const attention = (badges.openOrders ?? 0) + (badges.lowStock ?? 0) + (badges.newCustomers ?? 0) + (badges.newSubscribers ?? 0) + (badges.openRequests ?? 0) > 0; const close = () => ref.current && (ref.current.open = false); return (
{attention &&
{children}
); }