'use client'; import Image from 'next/image'; import Link from 'next/link'; import { useState } from 'react'; import type { PlazaPost } from '@/types/plaza'; import { categoryAccent, formatCount, formatRelativeTime } from '@/lib/format'; import { plazaPath } from '@/lib/site'; export function PostCard({ post, priority = false }: { post: PlazaPost; priority?: boolean }) { const [coverFailed, setCoverFailed] = useState(false); const showFallback = !post.cover_url || coverFailed; const accent = categoryAccent(post.category.slug); const initial = post.title.trim().charAt(0) || '้กต'; return (
{showFallback ? (
{initial}
) : ( {post.title} setCoverFailed(true)} /> )}

{post.title}

{post.summary ? (

{post.summary}

) : null}
{post.author.display_name} {formatRelativeTime(post.published_at)}
๐Ÿ‘ {formatCount(post.stats.like_count)} ๐Ÿ’ฌ {formatCount(post.stats.comment_count)}
); }