Skip to content

Commit 2e7547d

Browse files
authored
Merge branch 'dev' into feat(web)/add-function-return-types
2 parents fc27d72 + 2739c3e commit 2e7547d

File tree

4 files changed

+16
-34
lines changed

4 files changed

+16
-34
lines changed

web/src/components/DisputeCard/index.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { utils } from "ethers";
55
import Skeleton from "react-loading-skeleton";
66
import { Card } from "@kleros/ui-components-library";
77
import { Periods } from "consts/periods";
8-
import { useGetMetaEvidence } from "queries/useGetMetaEvidence";
9-
import { useCourtPolicy } from "queries/useCourtPolicy";
108
import { CasesPageQuery } from "queries/useCasesQuery";
11-
import PeriodBanner from "./PeriodBanner";
9+
import { useCourtPolicy } from "queries/useCourtPolicy";
10+
import { useGetMetaEvidence } from "queries/useGetMetaEvidence";
1211
import DisputeInfo from "./DisputeInfo";
12+
import PeriodBanner from "./PeriodBanner";
1313

1414
const StyledCard = styled(Card)`
1515
max-width: 380px;
@@ -29,11 +29,7 @@ const Container = styled.div`
2929
}
3030
`;
3131

32-
const getPeriodEndTimestamp = (
33-
lastPeriodChange: string,
34-
currentPeriodIndex: number,
35-
timesPerPeriod: string[]
36-
) => {
32+
const getPeriodEndTimestamp = (lastPeriodChange: string, currentPeriodIndex: number, timesPerPeriod: string[]) => {
3733
const durationCurrentPeriod = parseInt(timesPerPeriod[currentPeriodIndex]);
3834
return parseInt(lastPeriodChange) + durationCurrentPeriod;
3935
};
@@ -50,11 +46,7 @@ const DisputeCard: React.FC<CasesPageQuery["disputes"][number]> = ({
5046
const date =
5147
currentPeriodIndex === 4
5248
? lastPeriodChange
53-
: getPeriodEndTimestamp(
54-
lastPeriodChange,
55-
currentPeriodIndex,
56-
court.timesPerPeriod
57-
);
49+
: getPeriodEndTimestamp(lastPeriodChange, currentPeriodIndex, court.timesPerPeriod);
5850
const { data: metaEvidence } = useGetMetaEvidence(id, arbitrated.id);
5951
const title = metaEvidence ? metaEvidence.title : <Skeleton />;
6052
const { data: courtPolicy } = useCourtPolicy(court.id);

web/src/pages/Cases/CaseDetails/index.tsx

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,35 @@
11
import React from "react";
22
import styled from "styled-components";
3-
import { Routes, Route, useParams, Navigate } from "react-router-dom";
3+
import { Route, Routes, useParams, Navigate } from "react-router-dom";
44
import { Card } from "@kleros/ui-components-library";
55
import { Periods } from "consts/periods";
66
import { useDisputeDetailsQuery } from "queries/useDisputeDetailsQuery";
7+
import Appeal from "./Appeal";
8+
import Evidence from "./Evidence";
9+
import Overview from "./Overview";
710
import Tabs from "./Tabs";
811
import Timeline from "./Timeline";
9-
import Overview from "./Overview";
10-
import Evidence from "./Evidence";
1112
import Voting from "./Voting";
12-
import Appeal from "./Appeal";
1313

1414
const CaseDetails: React.FC = () => {
1515
const { id } = useParams();
1616
const { data } = useDisputeDetailsQuery(id);
1717
const dispute = data?.dispute;
1818
const currentPeriodIndex = dispute ? Periods[dispute.period] : 0;
1919
const arbitrable = dispute?.arbitrated.id;
20+
2021
return (
2122
<Container>
2223
<h1>Case #{id}</h1>
2324
<Tabs />
2425
<Timeline {...{ currentPeriodIndex, dispute }} />
2526
<StyledCard>
2627
<Routes>
27-
<Route
28-
path="overview"
29-
element={
30-
<Overview courtID={dispute?.court.id} {...{ arbitrable }} />
31-
}
32-
/>
28+
<Route path="overview" element={<Overview courtID={dispute?.court.id} {...{ arbitrable }} />} />
3329
<Route path="evidence" element={<Evidence {...{ arbitrable }} />} />
34-
<Route
35-
path="voting"
36-
element={<Voting {...{ arbitrable, currentPeriodIndex }} />}
37-
/>
38-
<Route
39-
path="appeal"
40-
element={<Appeal {...{ currentPeriodIndex }} />}
41-
/>
42-
<Route path="*" element={<Navigate to="overview" />} />
30+
<Route path="voting" element={<Voting {...{ arbitrable, currentPeriodIndex }} />} />
31+
<Route path="appeal" element={<Appeal {...{ currentPeriodIndex }} />} />
32+
<Route path="*" element={<Navigate to="overview" replace />} />
4333
</Routes>
4434
</StyledCard>
4535
</Container>

web/src/pages/Courts/CourtDetails/Description.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const Description: React.FC = () => {
5757
<Route path="purpose" element={formatMarkdown(policy?.description)} />
5858
<Route path="skills" element={<p>{policy?.requiredSkills}</p>} />
5959
<Route path="policy" element={formatMarkdown(policy?.summary)} />
60-
<Route path="*" element={<Navigate to="purpose" />} />
60+
<Route path="*" element={<Navigate to="purpose" replace />} />
6161
</Routes>
6262
</TextContainer>
6363
</Container>

web/src/pages/Courts/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Courts: React.FC = () => {
1717
<TopSearch />
1818
<Routes>
1919
<Route path="/:id/*" element={<CourtDetails />} />
20-
<Route path="*" element={<Navigate to="1" />} />
20+
<Route path="*" element={<Navigate to="1" replace />} />
2121
</Routes>
2222
</Container>
2323
);

0 commit comments

Comments
 (0)