import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { FriendScreen } from "@/components/PersonScreen";
import { getPersonByToken } from "@/lib/data";

export const metadata: Metadata = { title: "Cosa mangi? · AmiCibi" };

export default async function FriendPage({ params }: PageProps<"/p/[token]">) {
  const { token } = await params;
  const p = await getPersonByToken(token);
  if (!p) notFound();
  return <FriendScreen token={token} name={p.name} notes={p.notes} items={p.items} />;
}
