feat(hide): 密码可见隐藏块,发帖双栏预览与门禁体验修复

增加密码解锁与游客签名 cookie;发帖页对齐 1440 并默认双栏预览;修复 locked 解析、按钮对比度与回复聚焦。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-17 05:46:42 +08:00
parent 01e2fd05ca
commit c44b0efa7d
23 changed files with 911 additions and 132 deletions

View File

@@ -136,6 +136,22 @@ export default function CommentSection({
}
}, [commentsOpen]);
// 登录回跳 / 隐藏块「去回复」:滚到评论框并聚焦
useEffect(() => {
if (!user || !commentsOpen) return;
const focusComposer = () => {
const hash = window.location.hash;
if (hash !== "#comment-input" && hash !== "#comments") return;
const el = textareaRef.current ?? document.getElementById("comment-input");
if (!(el instanceof HTMLTextAreaElement)) return;
el.scrollIntoView({ behavior: "smooth", block: "center" });
window.setTimeout(() => el.focus({ preventScroll: true }), 280);
};
focusComposer();
window.addEventListener("hashchange", focusComposer);
return () => window.removeEventListener("hashchange", focusComposer);
}, [user, commentsOpen]);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!commentsOpen || !content.trim()) return;
@@ -1034,7 +1050,7 @@ export default function CommentSection({
}
return (
<section className="panel p-6 sm:p-8 mt-6" aria-label="评论区">
<section id="comments" className="panel p-6 sm:p-8 mt-6 scroll-mt-24" aria-label="评论区">
<div className="flex items-center gap-2.5 mb-6">
<h2 className="text-lg font-semibold" style={{ color: "var(--ink)" }}>
评论
@@ -1063,7 +1079,7 @@ export default function CommentSection({
}}
placeholder="友善发言,发表一个新楼层..."
rows={3}
className="field"
className="field scroll-mt-28"
aria-label="写评论"
/>
<div className="flex items-center justify-between gap-3 mt-2.5">