From 84616ff4a13adaf3aab0a7df80a8b8b78e40582d Mon Sep 17 00:00:00 2001 From: lezi-fun <177434121+lezi-fun@users.noreply.github.com> Date: Tue, 11 Aug 2026 22:07:10 +0800 Subject: [PATCH] feat: remove reply indicator, dynamic folding (min 3 replies) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove per-reply '正在回复 @xxx' indicator. Collapse replies: show count based on viewport height (min 3). Clean up unused CSS. --- app/globals.css | 35 ----------------------------------- components/ReplyList.js | 20 ++++++-------------- 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/app/globals.css b/app/globals.css index 5f2505b..13e0002 100644 --- a/app/globals.css +++ b/app/globals.css @@ -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); diff --git a/components/ReplyList.js b/components/ReplyList.js index 501e819..6b5a704 100644 --- a/components/ReplyList.js +++ b/components/ReplyList.js @@ -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 }) { )}
- {r.reply_to_username && ( -