fix: replies drawer auto-expand, settings no-scroll, title bug, admin links

- PostDetail: replies open as drawer (grid-rows animation) automatically
  after post loads — no toggle button
- SettingsPage: outer frame overflow hidden (100vh), only inner panel
  scrolls; hide #app layout when not on feed (fixes navbar moving when
  scrolling settings)
- Title: metadata 'Loading...' → 'Forumlify' (Next resets <title> to
  metadata on re-render → title became Loading... after load); unify
  title effect (rotate Loading. only while !ready && !forumNameLoaded)
- AdminLinks: link divider uses var(--border) (was #f1f5f9, invisible
  in dark mode); add admin.link i18n keys
- AdminPage i18n nav labels
This commit is contained in:
lezi-fun committed 2026-08-11 17:35:48 +08:00
1 parent ad89aa3e04
commit 5a9a454ef3
9 files changed
+76 -20

No files matched your search

+5 -4
View File
@@ -204,9 +204,10 @@ export default function AppProvider({ children, cachedName = '' }) {
init();
}, []);
// 页面标题:初始化中轮换 Loading. → Loading.. → Loading...,完成后显示论坛名
// 页面标题:初始化中轮换 Loading. → Loading.. → Loading...,收到论坛名/完成后显示论坛名
useEffect(() => {
if (!ready) {
// 尚未收到论坛名且未完成初始化:轮换 Loading.
if (!ready && !forumNameLoaded) {
const seq = ['Loading.', 'Loading..', 'Loading...'];
let i = 0;
document.title = seq[0];
@@ -218,11 +219,11 @@ export default function AppProvider({ children, cachedName = '' }) {
clearInterval(t);
};
}
// 初始化完成:标题恢复为论坛名
// 已收到论坛名或初始化完成:标题显示论坛名(Next 重置 metadata 时也能恢复)
document.title = forumName;
const titleEl = document.querySelector('title');
if (titleEl) titleEl.textContent = forumName;
}, [ready, forumName]);
}, [ready, forumNameLoaded, forumName]);
// 按 URL 参数初始化视图
useEffect(() => {
+17 -1
View File
@@ -28,6 +28,15 @@ export default function PostDetail({ postId, initialPost = null }) {
const [editImages, setEditImages] = useState([]);
const [editUploading, setEditUploading] = useState(false);
const editImageInputRef = useRef(null);
// 评论抽屉:帖子加载完成后自动展开(动画完整播放)
const [repliesOpen, setRepliesOpen] = useState(false);
useEffect(() => {
if (post && !repliesOpen) {
// 延迟到帖子内容渲染后,让抽屉动画平滑播放
const t = setTimeout(() => setRepliesOpen(true), 60);
return () => clearTimeout(t);
}
}, [post]);
const load = useCallback(async () => {
setError(null);
@@ -183,7 +192,14 @@ export default function PostDetail({ postId, initialPost = null }) {
<div className="post-detail-signature" style={{ marginTop: 16, paddingTop: 12, borderTop: '1px solid var(--border-light)', fontSize: 12, color: 'var(--text-secondary)' }} dangerouslySetInnerHTML={{ __html: renderedSignature }} />
)}
</div>
<ReplyList postId={postId} onRefresh={load} />
<div style={{ maxWidth: 700, margin: '0 auto', width: '100%', marginTop: 16 }}>
{/* 评论抽屉:帖子加载完成后自动展开 */}
<div className={'replies-drawer' + (repliesOpen ? ' open' : '')}>
<div className="replies-drawer-inner">
<ReplyList postId={postId} onRefresh={load} />
</div>
</div>
</div>
</div>
</div>
+1 -1
View File
@@ -46,7 +46,7 @@ export default function SettingsPage() {
};
return (
<div className="page-slide active">
<div className="page-slide active" style={{ overflow: 'hidden', height: '100vh' }}>
<div className="page-header" style={{ width: '100%' }}>
<h2><Icon name="settings" size={20} /> {t('settings.title')}</h2>
</div>
+1 -1
View File
@@ -59,7 +59,7 @@ export default function AdminLinks() {
<div style={{ color: '#94a3b8', fontSize: 13 }}>{t('admin.link.empty')}</div>
) : (
links.map((l) => (
<div key={l.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '8px 0', borderBottom: '1px solid #f1f5f9' }}>
<div key={l.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '8px 0', borderBottom: '1px solid var(--border)' }}>
<span><a href={l.url} target="_blank" rel="noreferrer" style={{ color: '#6366f1', textDecoration: 'none' }}>{l.title}</a></span>
<button className="btn-sm btn-danger" onClick={() => handleDelete(l.id)}>
<Icon name="trash" size={12} /> {t('admin.common.delete')}