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"; import BadgeChip from "@/components/BadgeChip"; // 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, boardNames, boardColors, }: { profile: UserProfile; allowComments: boolean; /** 板块 id → 名称/配色:板块管理员徽章展示「{板块名}板块管理员」并对齐板块色 */ boardNames?: Record; boardColors?: Record; }) { 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}

{/* 徽章行:站点角色 + 管理员颁布徽章统一收拢一处,悬浮显示颁布时间;窄栏最多 4 枚 */} {(u.role !== "user" || (u.badges ?? []).length > 0) && (
{u.role !== "user" && ( )} {(u.badges ?? []).slice(0, 4).map((ub) => ( ))}
)} {/* 有签名则展示;无则留空,不放占位文案 */} {signature ? (

{signature}

) : null} {/* 数据面板:圆角浅底 + 竖线分隔(参考作者卡布局,配色走站点令牌) */}
{stats.map((s, i) => (
0 ? { borderLeft: "1px solid var(--line)" } : undefined} >

{s.value}

{s.label}

))}
{/* 连签胶囊:金色调软底,与站点 gold 令牌一致 */} {streak > 0 && (

连签 {streak} 天

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

TA 的其他帖子

    {posts.map((p) => (
  • {p.title} {formatYMD(p.created_at)}
  • ))}
); }