From 9d3ea4d95c2cdcea02b2bfd3884ff5576de09e04 Mon Sep 17 00:00:00 2001 From: freefire Date: Wed, 16 Sep 2026 05:58:20 +0800 Subject: [PATCH] =?UTF-8?q?polish(frontend):=20=E5=8A=A0=E5=A4=A7=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E4=BE=A7=E6=A0=8F=E7=BE=A4=E5=90=8D=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=BC=BA=E5=8C=96=E5=B8=96=E5=AD=90=E9=A1=B5=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 作者卡补充签名、积分与连签;聊天会话标题字号调至 15px。 Co-authored-by: Cursor --- frontend/app/chat/ChatShell.tsx | 2 +- frontend/app/post/[id]/page.tsx | 113 ++++++++++++++++++++++++-------- 2 files changed, 85 insertions(+), 30 deletions(-) diff --git a/frontend/app/chat/ChatShell.tsx b/frontend/app/chat/ChatShell.tsx index c6ebbe1..7a20ac6 100644 --- a/frontend/app/chat/ChatShell.tsx +++ b/frontend/app/chat/ChatShell.tsx @@ -468,7 +468,7 @@ export default function ChatShell({
{roomTitle(room)} diff --git a/frontend/app/post/[id]/page.tsx b/frontend/app/post/[id]/page.tsx index cd8e334..251ba31 100644 --- a/frontend/app/post/[id]/page.tsx +++ b/frontend/app/post/[id]/page.tsx @@ -88,11 +88,6 @@ function extractToc(content: string): TocItem[] { return items; } -function formatYearMonth(dateStr: string) { - const d = new Date(dateStr); - return `${d.getFullYear()}.${String(d.getMonth() + 1).padStart(2, "0")}`; -} - function formatYMD(dateStr: string) { const d = new Date(dateStr); return `${d.getFullYear()}.${String(d.getMonth() + 1).padStart(2, "0")}.${String( @@ -151,6 +146,13 @@ function BoardCard({ board }: { board: Board }) { function AuthorRailCard({ profile }: { profile: UserProfile }) { const u = profile.user; + const signature = (u.signature || "").trim(); + const { post_count, comment_count, points, streak } = profile.stats; + const stats = [ + { label: "发帖", value: post_count }, + { label: "评论", value: comment_count }, + { label: "积分", value: points }, + ]; return (

@@ -168,21 +170,55 @@ function AuthorRailCard({ profile }: { profile: UserProfile }) { > {u.nickname} - {u.role !== "user" && } +

@{u.username}

+ {u.role !== "user" && ( +
+ +
+ )}
-

{formatYearMonth(u.created_at)} 加入

-
-
- {profile.stats.post_count} - 发帖 -
-
- {profile.stats.comment_count} - 评论 -
+ {/* 有签名则展示;无则留空,不放占位文案 */} + {signature ? ( +

+ {signature} +

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

+ {s.value} +

+

+ {s.label} +

+
+ ))}
- + {streak > 0 && ( +

+ 连签 {streak} 天 +

+ )} + 访问主页 @@ -278,6 +314,9 @@ function RelatedPosts({ /* 移动端 / 窄屏作者卡(xl 以下内联在正文与评论之间,替代左栏作者模块) */ function AuthorCardStacked({ profile }: { profile: UserProfile }) { + const u = profile.user; + const signature = (u.signature || "").trim(); + const { post_count, comment_count, points, streak } = profile.stats; return (

关于作者

-
- - +
+ +
- {profile.user.nickname} + {u.nickname} - {profile.user.role !== "user" && ( - - )} + {u.role !== "user" && }
-

- {formatYearMonth(profile.user.created_at)} 加入 · 发帖 {profile.stats.post_count} · 评论{" "} - {profile.stats.comment_count} +

+ @{u.username} + · + 发帖 {post_count} + · + 评论 {comment_count} + · + 积分 {points} + {streak > 0 && ( + <> + · + + 连签 {streak} 天 + + + )}

+ {signature ? ( +

+ {signature} +

+ ) : null}
- + 访问主页