summaryrefslogtreecommitdiff
path: root/frontend/src/plugin-loader.tsx
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-08-26 01:18:28 -0400
committerAAGaming <aa@mail.catvibers.me>2022-08-26 01:18:28 -0400
commitd4d1c2bbabfcec3c62767e614c9d67f516938af2 (patch)
treec30a7643507ade7200eff36e9c16d0512bb1edce /frontend/src/plugin-loader.tsx
parenteffc4ab0f56119041ac6efecdbf0a782714ec783 (diff)
downloaddecky-loader-d4d1c2bbabfcec3c62767e614c9d67f516938af2.tar.gz
decky-loader-d4d1c2bbabfcec3c62767e614c9d67f516938af2.zip
basic patch notes viewer, lazy-load settings and store, build frontend as esmodule, add lazy-loaded react-markdown, backend changes to accomodate ESModule frontend
Diffstat (limited to 'frontend/src/plugin-loader.tsx')
-rw-r--r--frontend/src/plugin-loader.tsx42
1 files changed, 37 insertions, 5 deletions
diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx
index c0fc3d00..661a2f67 100644
--- a/frontend/src/plugin-loader.tsx
+++ b/frontend/src/plugin-loader.tsx
@@ -1,4 +1,5 @@
-import { ModalRoot, QuickAccessTab, Router, showModal, sleep, staticClasses } from 'decky-frontend-lib';
+import { ModalRoot, QuickAccessTab, Router, SteamSpinner, showModal, sleep, staticClasses } from 'decky-frontend-lib';
+import { Suspense, lazy } from 'react';
import { FaPlug } from 'react-icons/fa';
import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState';
@@ -6,8 +7,6 @@ import LegacyPlugin from './components/LegacyPlugin';
import PluginInstallModal from './components/modals/PluginInstallModal';
import NotificationBadge from './components/NotificationBadge';
import PluginView from './components/PluginView';
-import SettingsPage from './components/settings';
-import StorePage from './components/store/Store';
import TitleView from './components/TitleView';
import Logger from './logger';
import { Plugin } from './plugin';
@@ -61,11 +60,44 @@ class PluginLoader extends Logger {
),
});
- this.routerHook.addRoute('/decky/store', () => <StorePage />);
+ const StorePage = lazy(() => import('./components/store/Store'));
+ const SettingsPage = lazy(() => import('./components/settings'));
+
+ this.routerHook.addRoute('/decky/store', () => (
+ <Suspense
+ fallback={
+ <div
+ style={{
+ marginTop: '40px',
+ height: 'calc( 100% - 40px )',
+ overflowY: 'scroll',
+ }}
+ >
+ <SteamSpinner />
+ </div>
+ }
+ >
+ <StorePage />
+ </Suspense>
+ ));
this.routerHook.addRoute('/decky/settings', () => {
return (
<DeckyStateContextProvider deckyState={this.deckyState}>
- <SettingsPage />
+ <Suspense
+ fallback={
+ <div
+ style={{
+ marginTop: '40px',
+ height: 'calc( 100% - 40px )',
+ overflowY: 'scroll',
+ }}
+ >
+ <SteamSpinner />
+ </div>
+ }
+ >
+ <SettingsPage />
+ </Suspense>
</DeckyStateContextProvider>
);
});