import { api } from "@/trpc/server";
import { notFound } from "next/navigation";
import React from "react";
import LobbyPage from "@/app/_components/lobby/lobby-page";

async function Page({
  params,
}: {
  params: Promise<{
    id: string;
  }>;
}) {
  const sessionPlayer = await api.player.getBySession();
  const { id } = await params;
  const lobby = await api.lobby.get({ id });
  if (!lobby) return notFound();

  return <LobbyPage initialLobby={lobby} sessionPlayer={sessionPlayer} />;
}

export default Page;
