feat: remove reply indicator, dynamic folding (min 3 replies)

Remove per-reply '正在回复 @xxx' indicator. Collapse replies: show count based on viewport height (min 3). Clean up unused CSS.
This commit is contained in:
lezi-fun committed 2026-08-11 22:07:10 +08:00
1 parent a57d29ceed
commit 84616ff4a1
2 files changed
+6 -49

No files matched your search

-35
View File
@@ -3100,30 +3100,6 @@ a.btn-secondary {
.reply-btn { opacity: 0.8; }
}
/* ===== 回复指示器(Discourse 风格:↩ 正在回复 @xxx) ===== */
.reply-to-indicator {
display: inline-flex;
align-items: center;
gap: 4px;
margin-top: 4px;
margin-left: 8px;
padding: 2px 8px 2px 4px;
font-size: 12px;
color: var(--text-light);
cursor: pointer;
transition: color 0.15s;
border-left: 2px solid var(--border);
}
.reply-to-indicator:hover {
color: var(--primary);
border-left-color: var(--primary);
}
.reply-to-indicator strong {
color: var(--primary);
font-weight: 600;
margin-left: 2px;
}
/* ===== 回复框预览横条(简洁无背景) ===== */
.reply-preview-bar {
display: flex;
@@ -3155,17 +3131,6 @@ a.btn-secondary {
color: var(--primary);
}
/* ===== 回复层次缩进(Discourse 嵌套风格) ===== */
/* 有回复目标的回复:左侧缩进 + 保留圆角 */
.reply-item[data-username]:has(.reply-to-indicator) {
margin-left: 16px;
padding-left: 12px;
border-left: 2px solid var(--border);
}
.reply-item[data-username]:has(.reply-to-indicator):hover {
border-left-color: var(--primary);
}
/* ===== 帖子详情卡片 ===== */
.post-detail-card {
border-radius: var(--radius);
+6 -14
View File
@@ -94,10 +94,13 @@ export default function ReplyList({ postId, onRefresh }) {
// 正在回复的目标回复对象(用于显示 @用户名)
const replyToObj = replyTo ? replies.find((x) => x.id === replyTo) : null;
// 回复折叠:默认只显示最近 5 条,更多则显示"继续此消息串"
const SHOW_N = 5;
// 回复折叠:根据视口高度动态调整可见条数(至少 3 条)
const [showCount, setShowCount] = useState(3);
const [showAllReplies, setShowAllReplies] = useState(false);
const visibleReplies = showAllReplies ? replies : replies.slice(-SHOW_N);
useEffect(() => {
setShowCount(Math.max(3, Math.floor(window.innerHeight / 200)));
}, []);
const visibleReplies = showAllReplies ? replies : replies.slice(-showCount);
const hiddenCount = replies.length - visibleReplies.length;
return (
@@ -134,17 +137,6 @@ export default function ReplyList({ postId, onRefresh }) {
)}
</div>
<div className="reply-content" dangerouslySetInnerHTML={{ __html: renderMarkdown(r.content) }} />
{r.reply_to_username && (
<div
className="reply-to-indicator"
onClick={() => {
const target = document.querySelector(`.reply-item[data-reply-id="${r.reply_to_id}"]`);
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'center' });
}}
>
<Icon name="reply" size={11} /> 正在回复 <strong>@{r.reply_to_username}</strong>
</div>
)}
</div>
);
})