"use client"; /** * PostCard — renders one post in the public feed and the /u/me feed. * * • Caption in serif (locked, can't be edited) * • Image grid (max 5; collapses to one column on the cheap) * • "Source" link back to the page the quote came from * • Optional onDelete callback shown only when the owner is viewing * * The source link always lands the user on the original passage with `?hl=` * highlighting. If the stored source_url already carries `?hl=` we use it * verbatim; otherwise we synthesise one from the post's caption so older * posts (or imported data) still scroll to + highlight the text on click. */ import Image from "next/image"; import Link from "next/link"; import { Trash2, ExternalLink } from "lucide-react"; import type { Post } from "@/lib/social"; import { displaySourceLabel } from "@/lib/source-reference"; import { appendHighlight, hasHighlight } from "@/lib/text-highlight"; import { PostActionsFooter } from "./post-actions-footer"; export function PostCard({ post, onDelete, }: { post: Post; onDelete?: (id: string) => void; }) { const sourceHref = hasHighlight(post.source_url) || !post.caption ? post.source_url : appendHighlight(post.source_url, post.caption); return (

“{post.caption}”

{post.images && post.images.length > 0 ? (
{post.images.map((img) => (
))}
) : null}
{displaySourceLabel(post.source_url, post.source_title)}
{new Date(post.created_at).toLocaleDateString()} {onDelete ? ( ) : null}
{/* Action footer — like / comment / reshare on the left, add to collection on the right. */}
); }