import Link from "next/link"; import { Users } from "lucide-react"; import { requireAdmin } from "@/lib/session"; import { listUsers, pageNum, str } from "@/lib/queries/admin"; import { formatNumber } from "@/lib/format"; import { PageHeader } from "@/components/ui/page-header"; import { Badge } from "@/components/ui/badge"; import { EmptyState } from "@/components/ui/empty-state"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { DateCell, Pagination, Panel, SearchForm, numCell } from "@/components/admin/primitives"; export const dynamic = "force-dynamic"; export default async function AdminUsersPage({ searchParams }: { searchParams: Promise> }) { await requireAdmin(); const sp = await searchParams; const q = str(sp.q); const page = pageNum(sp.page); const data = await listUsers({ q: q || undefined, page }); return ( <> } /> {data.total === 0 ? (
) : ( <> Email Name Verified Role Banned Orgs Created Last login {data.rows.map((u) => ( {u.email} {u.name || "—"} {u.emailVerified ? verified : unverified} {u.role === "admin" ? admin : user} {u.banned ? banned : —} {u.orgs} ))}
)}
); }