Skip to content

Commit 98846e5

Browse files
authored
Merge branch 'dev' into feat/more-robust-type-validations-in-sdk
2 parents 2400378 + bbf5be2 commit 98846e5

File tree

6 files changed

+92
-26
lines changed

6 files changed

+92
-26
lines changed

web/src/app.tsx

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { lazy, Suspense } from "react";
22

33
import { Route } from "react-router-dom";
44

@@ -9,17 +9,18 @@ import IsListProvider from "context/IsListProvider";
99
import { NewDisputeProvider } from "context/NewDisputeContext";
1010
import QueryClientProvider from "context/QueryClientProvider";
1111
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"));
1219
import Web3Provider from "context/Web3Provider";
1320

21+
import Loader from "components/Loader";
1422
import Layout from "layout/index";
1523

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";
2324
import { SentryRoutes } from "./utils/sentry";
2425

2526
const App: React.FC = () => {
@@ -32,13 +33,62 @@ const App: React.FC = () => {
3233
<NewDisputeProvider>
3334
<SentryRoutes>
3435
<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+
/>
4292
<Route path="*" element={<h1>Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯</h1>} />
4393
</Route>
4494
</SentryRoutes>

web/src/components/Loader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const StyledKlerosIcon = styled(KlerosIcon)`
2828
`;
2929

3030
const Container = styled.div<{ width?: Width; height?: Height }>`
31+
margin: auto;
3132
width: ${({ width }) => width ?? "100%"};
3233
height: ${({ height }) => height ?? "100%"};
3334
`;

web/src/layout/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const StyledToastContainer = styled(ToastContainer)`
2929
`;
3030

3131
const OutletContainer = styled.div`
32+
display: flex;
3233
flex: 1;
3334
background-color: ${({ theme }) => theme.lightBackground};
3435
`;

web/src/pages/GetPnk/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import HeroImage from "components/HeroImage";
1010

1111
import { Widget } from "./Widget";
1212

13+
const Wrapper = styled.div`
14+
width: 100%;
15+
`;
16+
1317
const Container = styled.div`
1418
width: 100%;
1519
background-color: ${({ theme }) => theme.lightBackground};
@@ -25,13 +29,13 @@ const Container = styled.div`
2529

2630
const GetPnk: React.FC = () => {
2731
return (
28-
<>
32+
<Wrapper>
2933
<HeroImage />
3034
<Container>
3135
{!isProductionDeployment() && <ClaimPnkButton />}
3236
<Widget />
3337
</Container>
34-
</>
38+
</Wrapper>
3539
);
3640
};
3741

web/src/pages/Home/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import Community from "./Community";
1313
import CourtOverview from "./CourtOverview";
1414
import TopJurors from "./TopJurors";
1515

16+
const Wrapper = styled.div`
17+
width: 100%;
18+
`;
19+
1620
const Container = styled.div`
1721
width: 100%;
1822
background-color: ${({ theme }) => theme.lightBackground};
@@ -24,13 +28,15 @@ const Container = styled.div`
2428
const Home: React.FC = () => {
2529
return (
2630
<HomePageProvider timeframe={getOneYearAgoTimestamp()}>
27-
<HeroImage />
28-
<Container>
29-
<CourtOverview />
30-
<LatestCases />
31-
<TopJurors />
32-
<Community />
33-
</Container>
31+
<Wrapper>
32+
<HeroImage />
33+
<Container>
34+
<CourtOverview />
35+
<LatestCases />
36+
<TopJurors />
37+
<Community />
38+
</Container>
39+
</Wrapper>
3440
</HomePageProvider>
3541
);
3642
};

web/src/pages/Resolver/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import Policy from "./Policy";
2222
import Preview from "./Preview";
2323
import Timeline from "./Timeline";
2424

25+
const Wrapper = styled.div`
26+
width: 100%;
27+
`;
28+
2529
const Container = styled.div`
2630
display: flex;
2731
flex-direction: column;
@@ -71,7 +75,7 @@ const DisputeResolver: React.FC = () => {
7175
const { isConnected } = useAccount();
7276
const isPreviewPage = location.pathname.includes("/preview");
7377
return (
74-
<>
78+
<Wrapper>
7579
<HeroImage />
7680
<Container>
7781
{isConnected && !isPreviewPage ? <StyledLabel>Start a case</StyledLabel> : null}
@@ -101,7 +105,7 @@ const DisputeResolver: React.FC = () => {
101105
</ConnectWalletContainer>
102106
)}
103107
</Container>
104-
</>
108+
</Wrapper>
105109
);
106110
};
107111

0 commit comments

Comments
 (0)