"use client"; /** * A post shared into a chat, rendered as a card with its author. * * The contents are resolved by the BFF on every read, per viewer — never from * a snapshot frozen at send time. So a post that has since been deleted or * hidden arrives as `entity_unavailable` and renders as a tombstone rather * than quietly showing content the reader is no longer allowed to see. */ import Link from "next/link"; import { ImageOff } from "lucide-react"; import { UserAvatar } from "@/components/ui/user-avatar"; import type { Attachment } from "@/lib/chat"; export function SharedPostCard({ attachment }: { attachment: Attachment }) { const post = attachment.entity; if (!post || attachment.entity_unavailable) { return (
This post is no longer available
); } return ( {post.author_name} @{post.author_handle} {post.image_url && ( // eslint-disable-next-line @next/next/no-img-element )} {post.caption && ( {post.caption} )} {post.source_title && ( {post.source_title} )} ); }