import Link from "next/link"; import { notFound } from "next/navigation"; import { prisma } from "@/lib/prisma"; export const dynamic = "force-dynamic"; export default async function AdminRoomDetail({ params, }: { params: Promise<{ id: string }>; }) { const { id } = await params; // rooms is an emulator-owned table → Int id. const roomId = Number(id); if (!Number.isInteger(roomId) || roomId <= 0) notFound(); let room: Awaited> = null; try { room = await prisma.rooms.findUnique({ where: { id: roomId } }); } catch { room = null; } if (!room) notFound(); const fields: Array<[string, string]> = [ ["ID", String(room.id)], ["Name", room.name || "(unnamed)"], ["Description", room.description || "—"], ["Owner", `${room.ownerName || "—"} (#${room.ownerId})`], ["State", room.state], ["Users", `${room.users} / ${room.usersMax}`], ["Category", String(room.category)], ["Score", String(room.score)], ["Model", room.model], ["Guild ID", room.guildId ? String(room.guildId) : "—"], ["Tags", room.tags || "—"], ["Password", room.password ? "yes" : "—"], ["Public", room.isPublic === "1" ? "yes" : "no"], ["Staff picked", room.isStaffPicked === "1" ? "yes" : "no"], ["For sale", room.isForSale === "1" ? "yes" : "no"], ["Trade mode", String(room.tradeMode)], ]; return (

← Rooms

{room.name || "(unnamed)"}

ID {room.id} · owner {room.ownerName || "—"} · {room.users}/{room.usersMax}{" "} users · {room.state}

{fields.map(([label, value]) => ( ))}
{label} {value}
{room.ownerId ? (

View owner →

) : null}
); }