"use client"; import { use } from "react"; import { useQuery } from "@tanstack/react-query"; import Link from "next/link"; import { Landmark } from "lucide-react"; import { shareAPI } from "@/lib/api"; import type { Bill } from "@/lib/types"; import { billLabel, formatDate } from "@/lib/utils"; export default function SharedCollectionPage({ params }: { params: Promise<{ token: string }> }) { const { token } = use(params); const { data: collection, isLoading, isError } = useQuery({ queryKey: ["share-collection", token], queryFn: () => shareAPI.getCollection(token), retry: false, }); return (
{/* Minimal header */}
PocketVeto
{isLoading && (
Loading…
)} {isError && (

Collection not found or link is invalid.

)} {collection && ( <> {/* Header */}

{collection.name}

{collection.bill_count} {collection.bill_count === 1 ? "bill" : "bills"}

{/* Bill list */} {collection.bills.length === 0 ? (

No bills in this collection.

) : (
{collection.bills.map((bill: Bill) => (
{billLabel(bill.bill_type, bill.bill_number)} {bill.short_title || bill.title || "Untitled"}
{bill.latest_action_date && (

Latest action: {formatDate(bill.latest_action_date)}

)} ))}
)} {/* CTA */}
Follow these bills on PocketVeto →
)}
); }