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 (
No rooms yet.
No rooms listed yet.
{r.owner.username} · {r.occupancy}/{r.capacity}
{r.description &&{r.description}
} {r.t5de.length > 0 && (Here now: {r.t5de.map((u) => u.username).join(", ")}
)}{r.ownerName} · {r.occupancy}/{r.maxUsers} {r.ratings > 0 && ` · ★ ${r.score.toFixed(1)} (${r.ratings})`}
{r.description &&{r.description}
} {signedIn &&