-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.jsx
54 lines (50 loc) · 1.59 KB
/
App.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { Route, Routes } from "solid-app-router";
import { ErrorBoundary, lazy, Suspense } from "solid-js";
import CenteredCircularProgress from "./components/CenteredCircularProgress";
import Providers from "./config/providers.jsx";
const Home = lazy(() => import("./pages/Home.jsx"));
const NotFound = lazy(() => import("./pages/NotFound.jsx"));
const Subreddits = lazy(() => import("./pages/Subreddits.jsx"));
const Dataset = lazy(() => import("./pages/Dataset.jsx"));
const MenuBar = lazy(() => import("./components/MenuBar.jsx"));
function App() {
const ErrorPage = () => (
<Suspense fallback={<CenteredCircularProgress />}>
<Error />
</Suspense>
);
const HomePage = () => (
<Suspense fallback={<CenteredCircularProgress />}>
<Home />
</Suspense>
);
const SubredditsPage = () => (
<Suspense fallback={<CenteredCircularProgress />}>
<Subreddits />
</Suspense>
);
const DatasetPage = () => (
<Suspense fallback={<CenteredCircularProgress />}>
<Dataset />
</Suspense>
);
const NotFoundPage = () => (
<Suspense fallback={<CenteredCircularProgress />}>
<NotFound />
</Suspense>
);
return (
<Providers>
<MenuBar hideOnScroll={true} />
<ErrorBoundary fallback={<ErrorPage />}>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/subreddits" element={<SubredditsPage />} />
<Route path="/dataset" element={<DatasetPage />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
</ErrorBoundary>
</Providers>
);
}
export default App;