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)
This commit is contained in:
lezi-fun committed 2026-08-11 21:31:06 +08:00
1 parent d9c4079619
commit 16af1cfd41
2 files changed
+22 -1

No files matched your search

+5
View File
@@ -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);
}
+17 -1
View File
@@ -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 (
<>
<div className="post-reply-count" style={{ marginTop: 20, fontSize: 14, color: '#64748b' }}>
@@ -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 (
<div key={r.id} className="reply-item" data-username={r.username}>
<div key={r.id} className="reply-item" data-username={r.username} style={{ marginLeft: nestDepth ? nestDepth * 18 : 0 }}>
<div className="reply-header">
<img src={r.avatar_url || avatar(r.username)} className="reply-avatar" alt="" />
<span