diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx
index 095a695..ceb9a48 100644
--- a/src/app/admin/page.tsx
+++ b/src/app/admin/page.tsx
@@ -1,16 +1,11 @@
import { Metadata } from "next";
-import Link from "next/link";
import { redirect } from "next/navigation";
-import { revalidatePath } from "next/cache";
-
-import { Icon } from "@iconify/react";
-import { ReportStatus } from "@prisma/client";
import { auth } from "@/lib/auth";
-import { prisma } from "@/lib/prisma";
import BannerForm from "@/components/admin/banner-form";
import ControlCenter from "@/components/admin/control-center";
+import Reports from "@/components/admin/reports";
export const metadata: Metadata = {
title: "Admin - TomodachiShare",
@@ -26,21 +21,6 @@ export default async function AdminPage() {
if (!session || Number(session.user.id) !== Number(process.env.NEXT_PUBLIC_ADMIN_USER_ID)) redirect("/404");
- 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 (
@@ -73,83 +53,7 @@ export default async function AdminPage() {
-
-
-
-
- | Type |
- Status |
- Target |
- Reason |
- Notes |
- Reporter |
- Actions |
-
-
-
- {reports.map((report, index) => (
-
- |
-
- {report.reportType}
-
- |
-
-
- {report.status}
-
- |
-
- {report.targetId}
- |
- {report.reason} |
- {report.reasonNotes} |
-
- {report.authorId}
- |
-
-
-
-
- |
-
- ))}
-
-
-
+
);
}
diff --git a/src/app/mii/[id]/page.tsx b/src/app/mii/[id]/page.tsx
index c4ccd17..58cd8d8 100644
--- a/src/app/mii/[id]/page.tsx
+++ b/src/app/mii/[id]/page.tsx
@@ -195,8 +195,17 @@ export default async function MiiPage({ params }: Props) {
By: @{mii.user.username}
- Created: {mii.createdAt.toLocaleDateString("en-GB", { month: "long", day: "2-digit", year: "numeric" })} at{" "}
- {mii.createdAt.toLocaleTimeString("en-GB", { timeZone: "UTC" })} UTC
+ Created:{" "}
+ {mii.createdAt.toLocaleString("en-GB", {
+ day: "2-digit",
+ month: "long",
+ year: "numeric",
+ hour: "2-digit",
+ minute: "2-digit",
+ second: "2-digit",
+ timeZone: "UTC",
+ })}{" "}
+ UTC
diff --git a/src/components/admin/banner-form.tsx b/src/components/admin/banner-form.tsx
index 2566753..d3a89cd 100644
--- a/src/components/admin/banner-form.tsx
+++ b/src/components/admin/banner-form.tsx
@@ -14,16 +14,14 @@ export default function BannerForm() {
};
return (
-
+
setMessage(e.target.value)} />
-
-
-
-
+
+
);
}
diff --git a/src/components/admin/control-center.tsx b/src/components/admin/control-center.tsx
index 258b0bf..2783025 100644
--- a/src/components/admin/control-center.tsx
+++ b/src/components/admin/control-center.tsx
@@ -22,8 +22,7 @@ export default function ControlCenter() {
return (
-
-
+
setCanSubmit(e.target.checked)}
/>
+
diff --git a/src/components/admin/reports.tsx b/src/components/admin/reports.tsx
new file mode 100644
index 0000000..d42bcdc
--- /dev/null
+++ b/src/components/admin/reports.tsx
@@ -0,0 +1,154 @@
+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
+
+ )}
+
+ );
+}