import Link from "next/link"; import { revalidatePath } from "next/cache"; import { Icon } from "@iconify/react"; import { ReportStatus } from "@prisma/client"; import { prisma } from "@/lib/prisma"; export default async function Reports() { const reports = await prisma.report.findMany(); const updateStatus = async (formData: FormData) => { "use server"; const id = Number(formData.get("id")); const status = formData.get("status") as ReportStatus; await prisma.report.update({ where: { id }, data: { status }, }); revalidatePath("/admin"); }; return (
{reports.map((report) => (
{report.reportType} {report.status} {report.createdAt.toLocaleString("en-GB", { day: "2-digit", month: "long", year: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZone: "UTC", })}{" "} UTC

Target ID

{report.targetId}

Creator ID

{report.creatorId}

Reporter

{report.authorId}

Reason

{report.reason}

Notes

{report.reasonNotes}

))}
{reports.length === 0 && (

No reports to display

Reports will appear here when users submit them

)}
); }