import type { Metadata } from "next"; import Link from "next/link"; import { notFound, redirect } from "next/navigation"; import { ActionForm, SubmitButton } from "@/components/forms"; import { PageHeader } from "@/components/status"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { FieldGroup } from "@/components/ui/field"; import { api, getMe, unwrap } from "@/lib/api"; import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"; import { Input } from "@/components/ui/input"; import { closeRoom, removeImage, saveImage, saveRoom } from "../../actions"; import { RoomFields } from "../../room-fields"; export const metadata: Metadata = { title: "Edit room" }; export default async function EditRoom({ params }: { params: Promise<{ n: string }> }) { const { n } = await params; if (!/^[0-9]{1,9}$/.test(n)) notFound(); const me = await getMe(); if (!me) redirect(`/signin?next=/rooms/${n}/edit`); const [{ rooms }, { links }] = await Promise.all([ api["hosted-rooms"].get({ query: { mine: "1" } }).then(unwrap), api.account.get().then(unwrap), ]); const room = rooms.find((r) => String(r.n) === n); if (!room) notFound(); return (
Back to rooms Owned by {room.ownerName} · {room.occupancy} here now l.adult)} moderators />
Save
Image Shown in room lists. {room.image && ( // The room's image, from the hub. )} {room.image ? "Replace" : "Upload"} PNG or JPEG, up to 512 KB.
Save image
{room.image && ( Remove image )}
Close room Everyone in it is sent out. It can't be opened again. Close room
); }