1
- import React from "react" ;
1
+ import React , { lazy , Suspense } from "react" ;
2
2
3
3
import { Route } from "react-router-dom" ;
4
4
@@ -9,17 +9,18 @@ import IsListProvider from "context/IsListProvider";
9
9
import { NewDisputeProvider } from "context/NewDisputeContext" ;
10
10
import QueryClientProvider from "context/QueryClientProvider" ;
11
11
import StyledComponentsProvider from "context/StyledComponentsProvider" ;
12
+ const Home = lazy ( ( ) => import ( "./pages/Home" ) ) ;
13
+ const Cases = lazy ( ( ) => import ( "./pages/Cases" ) ) ;
14
+ const Dashboard = lazy ( ( ) => import ( "./pages/Dashboard" ) ) ;
15
+ const Courts = lazy ( ( ) => import ( "./pages/Courts" ) ) ;
16
+ const DisputeTemplateView = lazy ( ( ) => import ( "./pages/DisputeTemplateView" ) ) ;
17
+ const DisputeResolver = lazy ( ( ) => import ( "./pages/Resolver" ) ) ;
18
+ const GetPnk = lazy ( ( ) => import ( "./pages/GetPnk" ) ) ;
12
19
import Web3Provider from "context/Web3Provider" ;
13
20
21
+ import Loader from "components/Loader" ;
14
22
import Layout from "layout/index" ;
15
23
16
- import Cases from "./pages/Cases" ;
17
- import Courts from "./pages/Courts" ;
18
- import Dashboard from "./pages/Dashboard" ;
19
- import DisputeTemplateView from "./pages/DisputeTemplateView" ;
20
- import GetPnk from "./pages/GetPnk" ;
21
- import Home from "./pages/Home" ;
22
- import DisputeResolver from "./pages/Resolver" ;
23
24
import { SentryRoutes } from "./utils/sentry" ;
24
25
25
26
const App : React . FC = ( ) => {
@@ -32,13 +33,62 @@ const App: React.FC = () => {
32
33
< NewDisputeProvider >
33
34
< SentryRoutes >
34
35
< Route path = "/" element = { < Layout /> } >
35
- < Route index element = { < Home /> } />
36
- < Route path = "cases/*" element = { < Cases /> } />
37
- < Route path = "courts/*" element = { < Courts /> } />
38
- < Route path = "dashboard/:page/:order/:filter" element = { < Dashboard /> } />
39
- < Route path = "dispute-template" element = { < DisputeTemplateView /> } />
40
- < Route path = "resolver/*" element = { < DisputeResolver /> } />
41
- < Route path = "get-pnk/*" element = { < GetPnk /> } />
36
+ < Route
37
+ index
38
+ element = {
39
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
40
+ < Home />
41
+ </ Suspense >
42
+ }
43
+ />
44
+ < Route
45
+ path = "cases/*"
46
+ element = {
47
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
48
+ < Cases />
49
+ </ Suspense >
50
+ }
51
+ />
52
+ < Route
53
+ path = "courts/*"
54
+ element = {
55
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
56
+ < Courts />
57
+ </ Suspense >
58
+ }
59
+ />
60
+ < Route
61
+ path = "dashboard/:page/:order/:filter"
62
+ element = {
63
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
64
+ < Dashboard />
65
+ </ Suspense >
66
+ }
67
+ />
68
+ < Route
69
+ path = "dispute-template"
70
+ element = {
71
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
72
+ < DisputeTemplateView />
73
+ </ Suspense >
74
+ }
75
+ />
76
+ < Route
77
+ path = "resolver/*"
78
+ element = {
79
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
80
+ < DisputeResolver />
81
+ </ Suspense >
82
+ }
83
+ />
84
+ < Route
85
+ path = "get-pnk/*"
86
+ element = {
87
+ < Suspense fallback = { < Loader width = { "48px" } height = { "48px" } /> } >
88
+ < GetPnk />
89
+ </ Suspense >
90
+ }
91
+ />
42
92
< Route path = "*" element = { < h1 > Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯</ h1 > } />
43
93
</ Route >
44
94
</ SentryRoutes >
0 commit comments