import Link from "next/link"; import { ArrowLeft } from "lucide-react"; import type { PostListItem } from "@/lib/api"; import { formatRelative } from "@/lib/format"; import { getPublicSettingsCached } from "@/lib/serverData"; import { normalizePostType, postTypeLabel, contentAccessLabel, typeStatusLabel, typeStatusClass } from "@/lib/postMeta"; import LikeButton from "./LikeButton"; import Avatar from "./Avatar"; import { IconComment, IconEye } from "./Icons"; /** * 帖子列表行(参考社区信息流样式): * 大头像 + 标题(徽章内联)+ 第二行「板块 · 作者 · 发布时间 ← 最后回复」+ * 右侧评论数等统计垂直居中。用于首页/板块页/搜索结果。 * * 点击:标题 stretch-link 铺满整行进帖;仅头像/作者/回复者/点赞等加 above-link 抬层。 * 板块胶囊仅展示,不可点,避免误进板块筛选。 */ export default async function PostRow({ post, showBoard = false, index = 0, compact = false, showViews = true, showLike = true, }: { post: PostListItem; index?: number; /** 是否展示板块胶囊(不可点击,仅标识) */ showBoard?: boolean; compact?: boolean; showViews?: boolean; showLike?: boolean; }) { const allowComments = (await getPublicSettingsCached()).allow_comments !== false; const lastReply = post.last_reply; const replied = allowComments && lastReply && new Date(lastReply.created_at).getTime() > new Date(post.created_at).getTime() + 60_000; const pt = normalizePostType(post.post_type); const statusBadge = pt !== "discussion" ? typeStatusLabel(pt, post.type_status) : ""; const statusClass = statusBadge ? typeStatusClass(pt, post.type_status) : ""; const authorName = post.user.nickname || post.user.username; return (