import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader, Tag } from "@/components/status"; import { buttonVariants } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { api, getMe, unwrap, type HostedRoom } from "@/lib/api"; import { RoomActions } from "./room-actions"; export const metadata: Metadata = { title: "Rooms" }; export default async function Rooms() { const me = await getMe(); const [{ rooms }, { rooms: hosted }, mine] = await Promise.all([ api.rooms.get().then(unwrap), api["hosted-rooms"].get({ query: {} }).then(unwrap), me ? api["hosted-rooms"].get({ query: { mine: "1" } }).then(unwrap) : { rooms: [] as HostedRoom[] }, ]); const own = new Set(mine.rooms.map((r) => r.n)); return (
Rooms on T5DE, and public IMVU rooms of T5DE users. {me && ( New room )}

On T5DE

{hosted.length === 0 ? (

No rooms yet.

) : ( )}

On IMVU

{rooms.length === 0 ? (

No rooms listed yet.

) : ( )}
); } function HostedCard({ room: r, mine, signedIn }: { room: HostedRoom; mine: boolean; signedIn: boolean }) { return ( {r.image && ( // The room's image, from the hub. )}
{r.name} {r.rating === "adult" && Adult} {r.privacy === "private" && Private} {r.occupancy > 0 && ( {r.occupancy} here )} {mine && ( Edit )}

{r.ownerName} · {r.occupancy}/{r.maxUsers} {r.ratings > 0 && ` · ★ ${r.score.toFixed(1)} (${r.ratings})`}

{r.description &&

{r.description}

} {signedIn && }
); }