|
|
@@ -30,41 +30,94 @@ import { getClientConfig } from "../config/client";
|
|
|
import { type ClientApi, getClientApi } from "../client/api";
|
|
|
import { useAccessStore } from "../store";
|
|
|
|
|
|
-export function Loading(props: { noLogo?: boolean }) {
|
|
|
+export function Loading() {
|
|
|
return (
|
|
|
<div className={styles["loading-content"] + " no-dark"}>
|
|
|
- {!props.noLogo && <img src={loadingIcon.src} />}
|
|
|
+ <img src={loadingIcon.src} />
|
|
|
</div>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-const Artifacts = dynamic(async () => (await import("./artifacts")).Artifacts, {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
-
|
|
|
-const Settings = dynamic(async () => (await import("./settings")).Settings, {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
-
|
|
|
-const Chat = dynamic(async () => (await import("./chat")).Chat, {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
-
|
|
|
-const Record = dynamic(async () => (await import("./Record")), {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
-
|
|
|
-const NewChat = dynamic(async () => (await import("./new-chat")).NewChat, {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
-
|
|
|
-const MaskPage = dynamic(async () => (await import("./mask")).MaskPage, {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
+// 延时器
|
|
|
+export const delayer = (): Promise<any> => {
|
|
|
+ // 延时时间-秒
|
|
|
+ const time: number = 1;
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ resolve({});
|
|
|
+ }, time * 1000);
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
-const Sd = dynamic(async () => (await import("./sd")).Sd, {
|
|
|
- loading: () => <Loading noLogo />,
|
|
|
-});
|
|
|
+const Artifacts = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./artifacts")).Artifacts
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+const Settings = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./settings")).Settings
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+const Chat = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./chat")).Chat
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+const Record = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./Record"))
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+const NewChat = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./new-chat")).NewChat
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+const MaskPage = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./mask")).MaskPage
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+const Sd = dynamic(
|
|
|
+ async () => {
|
|
|
+ await delayer();
|
|
|
+ return (await import("./sd")).Sd
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }
|
|
|
+);
|
|
|
|
|
|
export function useSwitchTheme() {
|
|
|
const config = useAppConfig();
|
|
|
@@ -216,7 +269,7 @@ export function Home() {
|
|
|
useHtmlLang();
|
|
|
|
|
|
useEffect(() => {
|
|
|
- console.log("[Config] got config from build time", getClientConfig());
|
|
|
+ // console.log("[Config] got config from build time", getClientConfig());
|
|
|
useAccessStore.getState().fetch();
|
|
|
}, []);
|
|
|
|