diff --git a/app/HomeClient.js b/app/HomeClient.js index 142819e..2a553b0 100644 --- a/app/HomeClient.js +++ b/app/HomeClient.js @@ -34,7 +34,7 @@ function HomeInner() {
-
+
diff --git a/app/globals.css b/app/globals.css index 9f0333b..be60a35 100644 --- a/app/globals.css +++ b/app/globals.css @@ -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); +} diff --git a/app/layout.js b/app/layout.js index 34cef08..d949a1c 100644 --- a/app/layout.js +++ b/app/layout.js @@ -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 客户端重渲染会重置 为 metadata 值, + // 导致加载完成后标题又变回 "Loading..."。 + title: 'Forumlify', description: 'Forumlify - 简洁优雅的现代社区系统', }; diff --git a/components/AppProvider.js b/components/AppProvider.js index c9e01e3..bf2cb4c 100644 --- a/components/AppProvider.js +++ b/components/AppProvider.js @@ -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(() => { diff --git a/components/PostDetail.js b/components/PostDetail.js index 91e21d5..ac19db6 100644 --- a/components/PostDetail.js +++ b/components/PostDetail.js @@ -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> diff --git a/components/SettingsPage.js b/components/SettingsPage.js index 833b400..7619be8 100644 --- a/components/SettingsPage.js +++ b/components/SettingsPage.js @@ -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> diff --git a/components/admin/AdminLinks.js b/components/admin/AdminLinks.js index 035e0b7..94105a0 100644 --- a/components/admin/AdminLinks.js +++ b/components/admin/AdminLinks.js @@ -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')} diff --git a/locales/en.json b/locales/en.json index e34ff09..3cfa189 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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" } } -} +} \ No newline at end of file diff --git a/locales/zh.json b/locales/zh.json index d6cd78f..3129a05 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -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": "保存" } } -} +} \ No newline at end of file