import Link from "next/link"; import { Layers, ArrowRight, User, Flame, PenLine } from "lucide-react"; import type { UserProfile, PostListItem, Board } from "@/lib/api"; import BoardIcon, { boardColor } from "@/components/BoardIcon"; import Avatar from "@/components/Avatar"; import RoleBadge from "@/components/RoleBadge"; import LevelBadge from "@/components/LevelBadge"; // formatYMD 帖子详情页左栏「作者其他帖」日期 function formatYMD(dateStr: string) { const d = new Date(dateStr); return `${d.getFullYear()}.${String(d.getMonth() + 1).padStart(2, "0")}.${String( d.getDate() ).padStart(2, "0")}`; } /* ============================================================ 帖子详情页侧栏块(自 page.tsx 原样迁出,供侧栏注册表按配置渲染) ============================================================ */ export function BoardCard({ board }: { board: Board }) { const colorIdx = boardColor(board); return (

所属板块

{board.name} {board.description && (

{board.description}

)} 查看该板讨论
); } export function AuthorRailCard({ profile, allowComments, }: { profile: UserProfile; allowComments: boolean; }) { const u = profile.user; const signature = (u.signature || "").trim(); const { post_count, comment_count, points, streak } = profile.stats; const stats = [ { label: "发帖", value: post_count }, ...(allowComments ? [{ label: "评论", value: comment_count }] : []), { label: "积分", value: points }, ]; return (

作者

{u.nickname}

@{u.username}

{u.role !== "user" && (
)}
{/* 有签名则展示;无则留空,不放占位文案 */} {signature ? (

{signature}

) : null}
{stats.map((s, i) => (
0 ? { borderLeft: "1px solid var(--line)" } : undefined} >

{s.value}

{s.label}

))}
{streak > 0 && (

连签 {streak} 天

)} 访问主页
); } export function AuthorPosts({ posts }: { posts: PostListItem[] }) { if (posts.length === 0) return null; return (

TA 的其他帖子

); }