feat(splash): load latest chat message
Docker Image / Build and Push Docker Image (push) Has been cancelled

This commit is contained in:
2026-07-08 17:31:58 +08:00
parent 75aa084095
commit baf0deeb24
7 changed files with 268 additions and 4 deletions
+13 -1
View File
@@ -5,6 +5,7 @@ import { useEffect } from "react";
import { AppBottomNav, MobileShell } from "@/app/_components/core";
import { ROUTES } from "@/router/routes";
import { useAppNavigator } from "@/router/use-app-navigator";
import { useAuthState } from "@/stores/auth/auth-context";
import { pwaUtil } from "@/utils";
import {
@@ -14,6 +15,7 @@ import {
SplashLatestMessage,
SplashLogo,
} from "./components";
import { useSplashLatestMessage } from "./hooks/use-splash-latest-message";
import styles from "./components/splash-screen.module.css";
// 尽量早地缓存 beforeinstallprompt,避免用户停留 splash 时浏览器事件已触发并丢失。
@@ -23,6 +25,12 @@ if (typeof window !== "undefined") {
export function SplashScreen() {
const navigator = useAppNavigator();
const authState = useAuthState();
const latestMessage = useSplashLatestMessage({
hasInitialized: authState.hasInitialized,
isAuthLoading: authState.isLoading,
loginStatus: authState.loginStatus,
});
const handleStartChat = () => {
navigator.openChat({ replace: true });
@@ -45,7 +53,11 @@ export function SplashScreen() {
<div className={styles.content}>
<SplashLogo />
<div className={styles.spacer} />
<SplashLatestMessage onOpenChat={handleStartChat} />
<SplashLatestMessage
message={latestMessage.message}
isLoading={latestMessage.isLoading}
onOpenChat={handleStartChat}
/>
<SplashContent />
<div className={styles.buttonArea}>
<SplashButton onStartChat={handleStartChat} />