import RepoByIdClient from "./repo-client"

export default function Page({ searchParams }: { searchParams?: { id?: string; path?: string } }) {
  const id = (searchParams?.id as string) || ""
  const path = (searchParams?.path as string) || ""

  if (!id) {
    return (
      <div className="mx-auto max-w-3xl px-4 py-10 text-white/80">
        <h1 className="text-2xl font-semibold">Repository</h1>
        <p className="mt-2">Missing repository id. Go back to <a href="/github/repos" className="text-orange-400 underline">My GitHub Repositories</a>.</p>
      </div>
    )
  }

  return <RepoByIdClient repositoryId={id} initialPath={path} />
}
