"use client"; // The nav's "Network" destination (components/Nav.tsx) — "my equipment". // The redesign added the link but never the route, so it 404'd and the three // screens behind it (/nodes, /systems, /tokens) had no entry point in the nav // at all. This is the hub: it counts what's there, surfaces nodes that still // need configuring, and hands off to the existing pages. import { useEffect } from "react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useAuth } from "@/components/AuthProvider"; import { useNodes } from "@/lib/useNodes"; import { useSystems } from "@/lib/useSystems"; import { PageHeader } from "@/components/ui/PageHeader"; import { Card } from "@/components/ui/Card"; import { Badge } from "@/components/ui/Badge"; function HubCard({ href, title, description, count, countLabel, badge, }: { href: string; title: string; description: string; count: number | null; countLabel: string; badge?: React.ReactNode; }) { return (

{title}

{badge}

{description}

{count === null ? "—" : count} {countLabel}

); } export default function NetworkPage() { const { isAdmin, isOperator, loading: authLoading } = useAuth(); const router = useRouter(); const { nodes, loading: nodesLoading } = useNodes(); const { systems, loading: systemsLoading } = useSystems(); useEffect(() => { if (!authLoading && !isAdmin && !isOperator) router.replace("/"); }, [authLoading, isAdmin, isOperator, router]); // Every hook runs before this guard — see the note in app/nodes/page.tsx. if (authLoading || (!isAdmin && !isOperator)) return null; const pending = nodes.filter((n) => !n.configured); const online = nodes.filter((n) => n.status === "online" || n.status === "recording"); return (
0 ? ( {pending.length} need setup ) : undefined } />
); }