| 1 | "use client"; |
| 2 | |
| 3 | import { useQuery } from "@tanstack/react-query"; |
| 4 | import { useTranslations } |
| 5 | import { Server, Monitor |
| 6 | import Link from "next/link |
| 7 | import { orpc } |
| 8 | import { FleetResources } |
| 9 | import { StatCard } |
| 10 | |
| 11 | export default function AdminDashboard |
| 12 | const t = |
| 13 | const { data: |
| 14 | const { data: |
| 15 | |
| 16 | const onlineNodes = |
| 17 | |
| 18 | const QUICK_LINKS = |
| 19 | { href: "/admin/locations", |
| 20 | { href: "/admin/nodes", |
| 21 | { href: "/admin/nests", |
| 22 | { href: "/admin/servers/new", |
| 23 | ]; |
| 24 | |
| 25 | return ( |
| 26 | <div className="flex-1 overflow-auto px-4 py-5 md:px-6 |
| 27 | <div className="mx-auto max-w-5xl |
| 28 | <div className="mb-5 flex items-center gap-2.5 |
| 29 | <h1 className="text-sm font-semibold text-foreground |
| 30 | </div> |
| 31 | |
| 32 | <div className="mb-6 |
| 33 | <h2 className="mb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground |
| 34 | <div className="grid grid-cols-1 gap-3 sm:grid-cols-3 |
| 35 | <StatCard |
| 36 | icon={Server} |
| 37 | label={t(" |
| 38 | value={nodes?.length |
| 39 | sub={t(" |
| 40 | color="#22c55e" |
| 41 | /> |
| 42 | <StatCard |
| 43 | icon={Monitor} |
| 44 | label={t(" |
| 45 | value={servers?.length |
| 46 | color="#3b82f6" |
| 47 | /> |
| 48 | <StatCard |
| 49 | icon={Activity} |
| 50 | label={t(" |
| 51 | value={onlineNodes} |
| 52 | color="#f59e0b" |
| 53 | /> |
| 54 | </div> |
| 55 | </div> |
| 56 | |
| 57 | {nodes && servers |
| 58 | |
| 59 | <div> |
| 60 | <h2 className="mb-3 text-xs font-medium uppercase tracking-wider text-muted-foreground |
| 61 | <div className="grid grid-cols-1 gap-3 sm:grid-cols-2 |
| 62 | {QUICK_LINKS.map(( |
| 63 | <Link |
| 64 | key={link.href |
| 65 | href={link.href |
| 66 | className="group flex flex-col gap-1 rounded-xl border border-border bg-card p-4 transition-colors hover:bg-muted/40" |
| 67 | > |
| 68 | <span className="text-sm font-medium text-foreground group-hover:text-foreground |
| 69 | <span className="text-xs text-muted-foreground |
| 70 | </Link> |
| 71 | ))} |
| 72 | </div> |
| 73 | </div> |
| 74 | </div> |
| 75 | </div> |
| 76 | ); |
| 77 | } |