cleanup: remove chain view + show-more, all replies always visible
This commit is contained in:
1 parent
0aac277aea
commit
45ace3ba75
2 files changed
+1
-37
No files matched your search
@@ -3144,25 +3144,3 @@ a.btn-secondary {
|
|||||||
flex-wrap: wrap;
|
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);
|
|
||||||
}
|
|
||||||
+1
-15
@@ -94,15 +94,6 @@ export default function ReplyList({ postId, onRefresh }) {
|
|||||||
// 正在回复的目标回复对象(用于显示 @用户名)
|
// 正在回复的目标回复对象(用于显示 @用户名)
|
||||||
const replyToObj = replyTo ? replies.find((x) => x.id === replyTo) : null;
|
const replyToObj = replyTo ? replies.find((x) => x.id === replyTo) : null;
|
||||||
|
|
||||||
// 回复折叠:根据视口高度动态调整可见条数(至少 3 条)
|
|
||||||
const [showCount, setShowCount] = useState(3);
|
|
||||||
const [showAllReplies, setShowAllReplies] = useState(false);
|
|
||||||
useEffect(() => {
|
|
||||||
setShowCount(Math.max(3, Math.floor(window.innerHeight / 200)));
|
|
||||||
}, []);
|
|
||||||
const visibleReplies = showAllReplies ? replies : replies.slice(-showCount);
|
|
||||||
const hiddenCount = replies.length - visibleReplies.length;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="post-reply-count" style={{ marginTop: 20, fontSize: 14, color: '#64748b' }}>
|
<div className="post-reply-count" style={{ marginTop: 20, fontSize: 14, color: '#64748b' }}>
|
||||||
@@ -112,7 +103,7 @@ export default function ReplyList({ postId, onRefresh }) {
|
|||||||
{replies.length === 0 ? (
|
{replies.length === 0 ? (
|
||||||
<div style={{ color: '#94a3b8', padding: '20px 0', textAlign: 'center' }}><Icon name="message" size={16} /> 还没有回复,快来发表第一条回复吧</div>
|
<div style={{ color: '#94a3b8', padding: '20px 0', textAlign: 'center' }}><Icon name="message" size={16} /> 还没有回复,快来发表第一条回复吧</div>
|
||||||
) : (
|
) : (
|
||||||
visibleReplies.map((r) => {
|
replies.map((r) => {
|
||||||
const rTime = r.created_at ? new Date(r.created_at).toLocaleString('zh-CN') : '';
|
const rTime = r.created_at ? new Date(r.created_at).toLocaleString('zh-CN') : '';
|
||||||
const nestDepth = Math.min(replyDepths[r.id] || 0, 5);
|
const nestDepth = Math.min(replyDepths[r.id] || 0, 5);
|
||||||
return (
|
return (
|
||||||
@@ -141,11 +132,6 @@ export default function ReplyList({ postId, onRefresh }) {
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
{hiddenCount > 0 && (
|
|
||||||
<button className="reply-show-more" onClick={() => setShowAllReplies(true)}>
|
|
||||||
<Icon name="chevronDown" size={13} /> 继续此消息串(还有 {hiddenCount} 条回复)
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="replyArea" ref={replyAreaRef} style={{ marginTop: 24, borderTop: '1px solid var(--border)', paddingTop: 20 }}>
|
<div id="replyArea" ref={replyAreaRef} style={{ marginTop: 24, borderTop: '1px solid var(--border)', paddingTop: 20 }}>
|
||||||
|
|||||||
Reference in new issue
Block a user