export const dynamic = "force-dynamic"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getLettersByRecipient } from "@/lib/letters"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; export default async function LettersByRecipientPage({ params, }: { params: Promise<{ name: string }>; }) { const { name: encodedName } = await params; const name = decodeURIComponent(encodedName); const letters = await getLettersByRecipient(name); if (letters.length === 0) notFound(); return (
← Letters by Recipient

Letters to or including {name}

{letters.length} {letters.length === 1 ? "letter" : "letters"}

    {letters.map((letter) => (
  • To: {letter.recipientDisplay}

    {letter.date || "Undated"} {letter.location ? ` ยท ${letter.location}` : ""}

  • ))}
); }