import type { Metadata } from "next"; import { bff } from "@/lib/bff"; import { ogForQuiz } from "@/lib/og"; import type { QuizCard } from "@/lib/quiz"; import { QuizPlayer } from "./quiz-player"; type Props = { params: Promise<{ id: string }> }; /** * Link previews name the quiz. The quiz's card is the BFF's one public quiz * endpoint — title, description and what it's attached to, never questions — * so a shared link unfurls even though taking the quiz needs an account. */ export async function generateMetadata({ params }: Props): Promise { const { id } = await params; const card = await bff(`/quizzes/${encodeURIComponent(id)}`, { revalidate: 300, }).catch(() => null); if (!card) return { title: "Quiz" }; return { title: card.title, description: `A quiz on Prabhupāda Says — ${card.question_count} question${card.question_count === 1 ? "" : "s"}.`, ...ogForQuiz(card), }; } export default async function QuizPage({ params }: Props) { const { id } = await params; return ; }