diff --git a/app/globals.css b/app/globals.css index ebbe058..5f2505b 100644 --- a/app/globals.css +++ b/app/globals.css @@ -3179,3 +3179,25 @@ a.btn-secondary { flex-wrap: wrap; } } + +/* ===== 继续此消息串(Discourse 风格折叠) ===== */ +.reply-show-more { + display: flex; + align-items: center; + gap: 6px; + margin: 12px 0 4px; + padding: 8px 16px; + background: var(--glass-bg); + border: 1px solid var(--glass-border); + border-radius: var(--radius-sm); + color: var(--primary); + font-size: 13px; + font-weight: 500; + cursor: pointer; + transition: all 0.15s; +} +.reply-show-more:hover { + background: var(--primary); + color: #fff; + border-color: var(--primary); +} diff --git a/components/Icons.js b/components/Icons.js index c3950a1..ae34f83 100644 --- a/components/Icons.js +++ b/components/Icons.js @@ -22,6 +22,11 @@ const PATHS = { ), + chevronDown: ( + <> + + + ), settings: ( <> diff --git a/components/ReplyList.js b/components/ReplyList.js index 2071ad9..501e819 100644 --- a/components/ReplyList.js +++ b/components/ReplyList.js @@ -94,6 +94,12 @@ export default function ReplyList({ postId, onRefresh }) { // 正在回复的目标回复对象(用于显示 @用户名) const replyToObj = replyTo ? replies.find((x) => x.id === replyTo) : null; + // 回复折叠:默认只显示最近 5 条,更多则显示"继续此消息串" + const SHOW_N = 5; + const [showAllReplies, setShowAllReplies] = useState(false); + const visibleReplies = showAllReplies ? replies : replies.slice(-SHOW_N); + const hiddenCount = replies.length - visibleReplies.length; + return ( <>
@@ -103,7 +109,7 @@ export default function ReplyList({ postId, onRefresh }) { {replies.length === 0 ? (
还没有回复,快来发表第一条回复吧
) : ( - replies.map((r) => { + visibleReplies.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 ( @@ -143,6 +149,11 @@ export default function ReplyList({ postId, onRefresh }) { ); }) )} + {hiddenCount > 0 && ( + + )}