"use client"; /** * /u/[handle]/collections/[id] — single public-collection view for another * user's profile. Mirrors the auth user's /u/me/collections/[id] exactly — * the CollectionScrollCard carousel (cover + posts) — but read-only: no Edit * affordance, since the viewer doesn't own it. Private collections (or a bad * id) 403/404 from the BFF, which we treat as "not found". */ import { use, useEffect, useState } from "react"; import Link from "next/link"; import { notFound } from "next/navigation"; import { ArrowLeft } from "lucide-react"; import { collections, SocialError, type Collection, type Post, } from "@/lib/social"; import { CollectionScrollCard } from "@/components/social/collection/collection-scroll-card"; export default function PublicCollectionDetailPage(props: { params: Promise<{ handle: string; id: string }>; }) { const { handle, id } = use(props.params); const [c, setC] = useState(null); const [posts, setPosts] = useState([]); const [loading, setLoading] = useState(true); const [missing, setMissing] = useState(false); useEffect(() => { let cancelled = false; collections .get(id) .then(({ collection, posts }) => { if (cancelled) return; setC(collection); setPosts(posts ?? []); }) .catch((err) => { if (cancelled) return; if ( err instanceof SocialError && (err.status === 404 || err.status === 403) ) { setMissing(true); } }) .finally(() => !cancelled && setLoading(false)); return () => { cancelled = true; }; }, [id]); if (missing) notFound(); if (loading) return

Loading…

; if (!c) return null; return (
All collections
); }