import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { buildProfileUrl } from '@/lib/utils' import type { PostData } from '@/types' interface PostPreviewProps { post: PostData /** If set and > 0, shows an amber "+N new" badge on the engagement counts. */ newEngagementCount?: number /** Compact mode: lighter card, smaller avatar, 2-line text clamp, no counts or link. */ compact?: boolean } function formatDate(iso: string): string { try { const d = new Date(iso) if (!iso || isNaN(d.getTime())) return '' return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) } catch { return '' } } // ── Compact variant ─────────────────────────────────────────────────────────── function PostPreviewCompact({ post }: { post: PostData }) { const displayName = post.author.displayName ?? post.author.handle return (
{displayName} @{post.author.handle}
{post.text && ({post.text}
)}@{post.author.handle}{date ? ` · ${date}` : ''}
{post.text}
)} {/* Engagement counts */}