From 16af1cfd41bda256d42acd68c83e69c2cc286a81 Mon Sep 17 00:00:00 2001 From: lezi-fun <177434121+lezi-fun@users.noreply.github.com> Date: Tue, 11 Aug 2026 21:31:06 +0800 Subject: [PATCH] fix: reply nesting depth + post detail card radius - Replies: compute nesting depth via reply_to_username chain (depth tracking, max 5 levels, 18px indent per level) - Post detail card: add border-radius var(--radius) - Reply preview bar: cleaner bottom-border style (no blue box) --- app/globals.css | 5 +++++ components/ReplyList.js | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/globals.css b/app/globals.css index a903e85..d868c5c 100644 --- a/app/globals.css +++ b/app/globals.css @@ -3165,3 +3165,8 @@ a.btn-secondary { .reply-item[data-username]:has(.reply-to-indicator):hover { border-left-color: var(--primary); } + +/* ===== 帖子详情卡片 ===== */ +.post-detail-card { + border-radius: var(--radius); +} diff --git a/components/ReplyList.js b/components/ReplyList.js index 71c1b26..6046e76 100644 --- a/components/ReplyList.js +++ b/components/ReplyList.js @@ -76,6 +76,21 @@ export default function ReplyList({ postId, onRefresh }) { } }; + // 计算每条回复的嵌套深度(按 reply_to_username 追踪回复链) + const replyDepths = (() => { + const map = {}; + const getDepth = (r) => { + if (map[r.id] !== undefined) return map[r.id]; + if (!r.reply_to_username) { map[r.id] = 0; return 0; } + const parent = replies.find((x) => x.username === r.reply_to_username); + const d = parent ? getDepth(parent) + 1 : 0; + map[r.id] = d; + return d; + }; + replies.forEach((r) => getDepth(r)); + return map; + })(); + return ( <>
@@ -87,8 +102,9 @@ export default function ReplyList({ postId, onRefresh }) { ) : ( replies.map((r) => { const rTime = r.created_at ? new Date(r.created_at).toLocaleString('zh-CN') : ''; + const nestDepth = Math.min(replyDepths[r.id] || 0, 5); return ( -
+