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:
1 parent
ad89aa3e04
commit
5a9a454ef3
9 files changed
+76
-20
No files matched your search
+1
-1
@@ -34,7 +34,7 @@ function HomeInner() {
|
||||
<div className="app-fade-in">
|
||||
<Navbar onOpenModal={openModal} />
|
||||
<ChatManager />
|
||||
<div id="app" style={{ display: view === 'feed' ? 'flex' : 'none' }}>
|
||||
<div id="app" style={{ display: view === 'feed' ? undefined : 'none' }}>
|
||||
<Sidebar />
|
||||
<Feed onOpenModal={openModal} onReport={openReport} />
|
||||
</div>
|
||||
|
||||
@@ -3015,3 +3015,40 @@ a.btn-secondary {
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* ===== 评论抽屉(平滑展开/收起) ===== */
|
||||
.replies-drawer {
|
||||
display: grid;
|
||||
grid-template-rows: 0fr;
|
||||
transition: grid-template-rows 0.45s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
overflow: hidden;
|
||||
}
|
||||
.replies-drawer.open {
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
.replies-drawer > .replies-drawer-inner {
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
.replies-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--primary);
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
padding: 6px 10px;
|
||||
border-radius: 6px;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.replies-toggle:hover {
|
||||
background: var(--primary-bg);
|
||||
}
|
||||
.replies-toggle .chev {
|
||||
transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
.replies-toggle.open .chev {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
+4
-2
@@ -5,8 +5,10 @@ import { ToastProvider } from '@/components/Toast';
|
||||
import I18nInit from '@/components/I18nInit';
|
||||
|
||||
export const metadata = {
|
||||
// 初始标题由客户端 AppProvider 接管(加载时轮换 Loading.,完成后显示论坛名)
|
||||
title: 'Loading...',
|
||||
// 初始标题用默认论坛名(AppProvider 加载期轮换 Loading.,完成后覆盖为真实名)。
|
||||
// 注意:不能设 'Loading...' —— Next.js 客户端重渲染会重置 <title> 为 metadata 值,
|
||||
// 导致加载完成后标题又变回 "Loading..."。
|
||||
title: 'Forumlify',
|
||||
description: 'Forumlify - 简洁优雅的现代社区系统',
|
||||
};
|
||||
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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')}
|
||||
|
||||
+5
-5
@@ -218,13 +218,13 @@
|
||||
"system": "System"
|
||||
},
|
||||
"link": {
|
||||
"incomplete": "Please complete all fields",
|
||||
"add": "Add link",
|
||||
"empty": "No links yet",
|
||||
"incomplete": "Please fill in all fields",
|
||||
"addFailed": "Add failed: {{msg}}",
|
||||
"confirmDelete": "Delete this link?",
|
||||
"namePlaceholder": "Link name",
|
||||
"urlPlaceholder": "Link URL",
|
||||
"add": "Add",
|
||||
"empty": "No links"
|
||||
"urlPlaceholder": "Link URL"
|
||||
},
|
||||
"page": {
|
||||
"confirmDelete": "Delete this page?",
|
||||
@@ -277,4 +277,4 @@
|
||||
"save": "Save"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -218,13 +218,13 @@
|
||||
"system": "系统"
|
||||
},
|
||||
"link": {
|
||||
"add": "添加链接",
|
||||
"empty": "暂无链接",
|
||||
"incomplete": "请填写完整信息",
|
||||
"addFailed": "添加失败:{{msg}}",
|
||||
"confirmDelete": "确定删除该链接吗?",
|
||||
"confirmDelete": "确定要删除这个链接吗?",
|
||||
"namePlaceholder": "链接名称",
|
||||
"urlPlaceholder": "链接地址",
|
||||
"add": "添加",
|
||||
"empty": "暂无友情链接"
|
||||
"urlPlaceholder": "链接地址"
|
||||
},
|
||||
"page": {
|
||||
"confirmDelete": "确定要删除这个页面吗?",
|
||||
@@ -277,4 +277,4 @@
|
||||
"save": "保存"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user