Commit b6f722a4 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'optimize/loading' into 'main'

add loading for Start

See merge request !392
parents 9c95d331 3fffebe1
Pipeline #28437 passed with stages
in 9 minutes and 33 seconds
...@@ -4,12 +4,13 @@ import { initStrings, initSuperPrerelease } from "@/api"; ...@@ -4,12 +4,13 @@ import { initStrings, initSuperPrerelease } from "@/api";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { getUIContainer, initUIContainer } from "@/container/compat"; import { getUIContainer, initUIContainer } from "@/container/compat";
import { initReplaySocket, initSocket } from "@/middleware/socket"; import { initReplaySocket, initSocket } from "@/middleware/socket";
import sqliteMiddleWare, { sqliteCmd } from "@/middleware/sqlite";
import { import {
pollSocketLooper, pollSocketLooper,
pollSocketLooperWithAgent, pollSocketLooperWithAgent,
} from "@/service/executor"; } from "@/service/executor";
import { initSqlite } from "../Layout/utils";
const NeosConfig = useConfig(); const NeosConfig = useConfig();
// 连接SRVPRO服务 // 连接SRVPRO服务
...@@ -29,13 +30,7 @@ export const connectSrvpro = async (params: { ...@@ -29,13 +30,7 @@ export const connectSrvpro = async (params: {
await rustInit(url); await rustInit(url);
// 初始化sqlite // 初始化sqlite
await sqliteMiddleWare({ await initSqlite();
cmd: sqliteCmd.INIT,
initInfo: {
releaseDbUrl: NeosConfig.releaseDbUrl,
preReleaseDbUrl: NeosConfig.preReleaseDbUrl,
},
});
// 初始化I18N文案 // 初始化I18N文案
await initStrings(); await initStrings();
......
...@@ -6,8 +6,8 @@ import { useSnapshot } from "valtio"; ...@@ -6,8 +6,8 @@ import { useSnapshot } from "valtio";
import { getSSOSignInUrl } from "@/api"; import { getSSOSignInUrl } from "@/api";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { AudioActionType, changeScene } from "@/infra/audio"; import { AudioActionType, changeScene } from "@/infra/audio";
import { accountStore } from "@/stores"; import { accountStore, initStore } from "@/stores";
import { Background, SpecialButton } from "@/ui/Shared"; import { Background, Loading, SpecialButton } from "@/ui/Shared";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
...@@ -22,33 +22,38 @@ export const loader: LoaderFunction = async () => { ...@@ -22,33 +22,38 @@ export const loader: LoaderFunction = async () => {
export const Component: React.FC = () => { export const Component: React.FC = () => {
const { t } = useTranslation("Start"); const { t } = useTranslation("Start");
const { user } = useSnapshot(accountStore); const { user } = useSnapshot(accountStore);
const { progress } = useSnapshot(initStore.sqlite);
return ( return (
<> <>
<Background /> <Background />
<div className={styles.wrap}> <div className={styles.wrap}>
<main className={styles.main}> {progress === 1 ? (
<div className={styles.left}> <main className={styles.main}>
<img <div className={styles.left}>
className={styles["neos-logo"]} <img
src={`${NeosConfig.assetsPath}/neos-logo.svg`} className={styles["neos-logo"]}
alt="YGO NEOS" src={`${NeosConfig.assetsPath}/neos-logo.svg`}
/> alt="YGO NEOS"
<div className={styles.title}>{t("Title")}</div> />
<div className={styles.keywords}>{t("Keywords")}</div> <div className={styles.title}>{t("Title")}</div>
<div className={styles.details}>{t("Details")}</div> <div className={styles.keywords}>{t("Keywords")}</div>
<LoginBtn logined={Boolean(user)} /> <div className={styles.details}>{t("Details")}</div>
</div> <LoginBtn logined={Boolean(user)} />
<div className={styles.right}> </div>
<img <div className={styles.right}>
className={styles["neos-main-bg"]} <img
src={`${NeosConfig.assetsPath}/neos-main-bg.webp`} className={styles["neos-main-bg"]}
/> src={`${NeosConfig.assetsPath}/neos-main-bg.webp`}
<img />
className={styles["neos-main"]} <img
src={`${NeosConfig.assetsPath}/neos-main.webp`} className={styles["neos-main"]}
/> src={`${NeosConfig.assetsPath}/neos-main.webp`}
</div> />
</main> </div>
</main>
) : (
<Loading progress={progress * 100} />
)}
</div> </div>
</> </>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment