From 1c48eb2a658d7fa8beb4d6d85a2e314cfd1afc1a Mon Sep 17 00:00:00 2001 From: rift <117926989+Riftriot@users.noreply.github.com> Date: Wed, 27 Dec 2023 14:19:48 -0600 Subject: [PATCH] basic suspense --- src/index.tsx | 34 ++++++++++++++-------------------- src/routes.tsx | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 src/routes.tsx diff --git a/src/index.tsx b/src/index.tsx index eccc3b6..6a45bf3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,26 +1,20 @@ import { render } from "preact"; -import { LocationProvider, Router, Route } from "preact-iso"; -import { Home } from "./pages/Home"; -import { NotFound } from "./pages/_404.jsx"; -import { DiscordPage } from "./pages/discord.jsx"; -import { ProxyFrame } from "./pages/ProxyFrame.js"; -import { Settings } from "./pages/Settings/index.js"; +import { Suspense, lazy } from "preact/compat"; +const Routes = lazy(() => import("./routes")); -import "./style.css"; -import "./themes/main.css"; -import "./i18n"; - -export function App() { +export default function App() { return ( - - - - - - - - - + +
loading...
+ + } + > +
+ +
+
); } diff --git a/src/routes.tsx b/src/routes.tsx new file mode 100644 index 0000000..11d5180 --- /dev/null +++ b/src/routes.tsx @@ -0,0 +1,25 @@ +import { LocationProvider, Router, Route } from "preact-iso"; +import { Home } from "./pages/Home"; +import { NotFound } from "./pages/_404.jsx"; +import { DiscordPage } from "./pages/discord.jsx"; +import { ProxyFrame } from "./pages/ProxyFrame.js"; +import { Settings } from "./pages/Settings/index.js"; + +import "./style.css"; +import "./themes/main.css"; +import "./i18n"; + +export default function Routes() { + return ( + + + + + + + + + + ); +} +