feat: full-screen loading page with fade-in on init complete

- AppProvider: add 'ready' flag set after init (auth restore + settings)
- page.js: show LoadingScreen (spinner + forum name) until ready, then
  fade in main UI (.app-fade-in 0.4s) — no more unloaded UI flash
This commit is contained in:
lezi-fun committed 2026-08-10 16:43:56 +08:00
1 parent 599b6f3435
commit e50bb2ff3d
4 files changed
+80 -3

No files matched your search

+9 -3
View File
@@ -15,17 +15,23 @@ import CustomPage from '@/components/CustomPage';
import MessagesPage from '@/components/MessagesPage';
import ChatManager from '@/components/chat/ChatManager';
import Modals from '@/components/Modals';
import LoadingScreen from '@/components/LoadingScreen';
function HomeInner() {
const { view, currentPostId, currentUsername, currentPageName } = useApp();
const { view, currentPostId, currentUsername, currentPageName, ready, forumName } = useApp();
const [modal, setModal] = useState(null); // null | login | register | report
const [reportPostId, setReportPostId] = useState(null);
const openModal = (m) => setModal(m);
const openReport = (postId) => { setReportPostId(postId); setModal('report'); };
// 初始化未完成:显示全屏加载页,避免未加载完的界面闪烁
if (!ready) {
return <LoadingScreen forumName={forumName} />;
}
return (
<>
<div className="app-fade-in">
<Navbar onOpenModal={openModal} />
<ChatManager />
@@ -46,7 +52,7 @@ function HomeInner() {
</div>
<Modals modal={modal} onClose={() => setModal(null)} reportPostId={reportPostId} />
</>
</div>
);
}