import type { Metadata } from "next"; import Link from "next/link"; import { deleteUserAction } from "@/actions/users"; import { ConfirmButton } from "@/components/admin/ConfirmButton"; import { Flash } from "@/components/admin/Flash"; import { LinkButton } from "@/components/ui"; import { requireAdmin } from "@/lib/auth/dal"; import { formatDate } from "@/lib/format"; import { listUsersWithTags } from "@/lib/services/users"; export const metadata: Metadata = { title: "Users" }; export default async function AdminUsersPage({ searchParams, }: { searchParams: Promise>; }) { await requireAdmin(); const [sp, users] = await Promise.all([searchParams, listUsersWithTags()]); return (

Users

New account
{sp.created === "1" && Account created.} {sp.deleted === "1" && Account deleted.}
{users.map((user) => ( ))}
Username Role Tag access Created Actions
{user.username} {user.role === "admin" ? ( Admin ) : ( Author )} {user.role === "admin" ? "All tags" : user.tags.length === 0 ? "None yet" : user.tags.map((t) => t.name).join(", ")} {formatDate(user.createdAt)}
Edit {user.role !== "admin" && (
Delete
)}

Authors can write, edit, and publish their own posts under the tags you grant them. Only you can delete posts, manage pages, moderate comments, or change settings.

); }