Skip to content

Commit f7d0aff

Browse files
authored
Merge branch 'dev' into dev
2 parents 8d196d7 + 9b945af commit f7d0aff

File tree

38 files changed

+407
-340
lines changed

38 files changed

+407
-340
lines changed

kleros-sdk/src/dataMappings/retrieveRealityData.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export const retrieveRealityData = async (realityQuestionID: string, arbitrable?
5050
};
5151

5252
const questionData = await executeAction(questionMapping);
53-
console.log("questionData", questionData);
5453

5554
const templateMapping: AbiEventMapping = {
5655
type: "abi/event",
@@ -66,7 +65,6 @@ export const retrieveRealityData = async (realityQuestionID: string, arbitrable?
6665
};
6766

6867
const templateData = await executeAction(templateMapping);
69-
console.log("templateData", templateData);
7068

7169
if (!templateData) {
7270
throw new NotFoundError("Template Data", "Failed to retrieve template data");
@@ -82,8 +80,6 @@ export const retrieveRealityData = async (realityQuestionID: string, arbitrable?
8280
questionData.realityQuestion
8381
);
8482

85-
console.log("populatedTemplate", populatedTemplate);
86-
8783
let answers: RealityAnswer[] = [];
8884
if (populatedTemplate.type === "bool") {
8985
answers = [

kleros-sdk/src/dataMappings/utils/populateTemplate.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ export const populateTemplate = (mustacheTemplate: string, data: any): DisputeDe
99

1010
const validation = DisputeDetailsSchema.safeParse(dispute);
1111
if (!validation.success) {
12-
console.error("Validation errors:", validation.error.errors, "\n\nDispute details:", `${JSON.stringify(dispute)}`);
13-
throw new InvalidFormatError("Invalid dispute details format");
12+
throw validation.error;
1413
}
15-
console.log(dispute);
1614

1715
return dispute;
1816
};

web/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const App: React.FC = () => {
9595
</Suspense>
9696
}
9797
/>
98-
<Route path="*" element={<h1>Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯</h1>} />
98+
<Route path="*" element={<h1>Page not found</h1>} />
9999
</Route>
100100
</SentryRoutes>
101101
</NewDisputeProvider>

web/src/components/CasesDisplay/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const StyledTitle = styled.h1`
2424
margin: 0px;
2525
`;
2626

27+
const StyledLabel = styled.label`
28+
font-size: 16px;
29+
`;
30+
2731
interface ICasesDisplay extends ICasesGrid {
2832
numberDisputes?: number;
2933
numberClosedDisputes?: number;
@@ -54,10 +58,10 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
5458
) : null}
5559
</TitleContainer>
5660
<Search />
57-
<StatsAndFilters totalDisputes={numberDisputes ?? 0} closedDisputes={numberClosedDisputes ?? 0} />
61+
<StatsAndFilters totalDisputes={numberDisputes || 0} closedDisputes={numberClosedDisputes || 0} />
5862

5963
{disputes?.length === 0 ? (
60-
<h1>No cases found</h1>
64+
<StyledLabel>No cases found</StyledLabel>
6165
) : (
6266
<CasesGrid
6367
disputes={disputes}

web/src/components/DisputePreview/DisputeContext.tsx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@ const QuestionAndDescription = styled.div`
2626
word-wrap: break-word;
2727
div:first-child p:first-of-type {
2828
font-size: 16px;
29-
font-weight: 600;
29+
font-weight: 400;
30+
margin: 0;
3031
}
3132
`;
3233

33-
const StyledReactMarkDown = styled(ReactMarkdown)`
34-
margin: 0px;
35-
`;
36-
3734
const VotingOptions = styled(QuestionAndDescription)`
3835
display: flex;
3936
flex-direction: column;
@@ -45,16 +42,30 @@ const AnswersContainer = styled.div`
4542
flex-direction: column;
4643
`;
4744

45+
const AnswersHeader = styled.h3`
46+
margin: 0;
47+
`;
48+
4849
const Answer = styled.div`
4950
margin: 0px;
5051
display: flex;
5152
flex-wrap: wrap;
52-
gap: ${responsiveSize(2, 8)};
53+
gap: 6px;
5354
> label {
5455
max-width: 100%;
5556
}
5657
`;
5758

59+
const StyledSmall = styled.small`
60+
color: ${({ theme }) => theme.secondaryText};
61+
font-weight: 400;
62+
`;
63+
64+
const StyledLabel = styled.label`
65+
color: ${({ theme }) => theme.primaryText};
66+
font-weight: 600;
67+
`;
68+
5869
const AliasesContainer = styled.div`
5970
display: flex;
6071
flex-wrap: wrap;
@@ -70,11 +81,11 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
7081
const errMsg = isRpcError ? RPC_ERROR : INVALID_DISPUTE_DATA_ERROR;
7182
return (
7283
<>
73-
<StyledH1>{isUndefined(disputeDetails) ? <StyledSkeleton /> : disputeDetails?.title ?? errMsg}</StyledH1>
84+
<StyledH1>{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}</StyledH1>
7485
{!isUndefined(disputeDetails) && (
7586
<QuestionAndDescription>
76-
<StyledReactMarkDown>{disputeDetails?.question}</StyledReactMarkDown>
77-
<StyledReactMarkDown>{disputeDetails?.description}</StyledReactMarkDown>
87+
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
88+
<ReactMarkdown>{disputeDetails?.description}</ReactMarkdown>
7889
</QuestionAndDescription>
7990
)}
8091
{isUndefined(disputeDetails?.frontendUrl) ? null : (
@@ -83,15 +94,15 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
8394
</a>
8495
)}
8596
<VotingOptions>
86-
{isUndefined(disputeDetails) ? null : <h3>Voting Options</h3>}
97+
{isUndefined(disputeDetails) ? null : <AnswersHeader>Voting Options</AnswersHeader>}
8798
<AnswersContainer>
8899
{disputeDetails?.answers?.map((answer: IAnswer, i: number) => (
89100
<Answer key={answer.title}>
90-
<small>Option {i + 1}:</small>
91-
<label>
101+
<StyledSmall>{i + 1 + `.`}</StyledSmall>
102+
<StyledLabel>
92103
{answer.title}
93-
{answer.description ? ` - ${answer.description}` : null}
94-
</label>
104+
{answer.description.trim() ? ` - ${answer.description}` : null}
105+
</StyledLabel>
95106
</Answer>
96107
))}
97108
</AnswersContainer>
Lines changed: 28 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
11
import React from "react";
2-
import styled, { css } from "styled-components";
2+
import styled from "styled-components";
33

44
import PaperclipIcon from "svgs/icons/paperclip.svg";
55
import PolicyIcon from "svgs/icons/policy.svg";
66

77
import { getIpfsUrl } from "utils/getIpfsUrl";
88
import { isUndefined } from "utils/index";
99

10-
import { landscapeStyle } from "styles/landscapeStyle";
1110
import { responsiveSize } from "styles/responsiveSize";
1211

1312
import { InternalLink } from "components/InternalLink";
1413

15-
const ShadeArea = styled.div`
14+
const Container = styled.div`
1615
display: flex;
17-
flex-direction: column;
18-
justify-content: center;
19-
width: 100%;
16+
align-items: center;
17+
flex-direction: row;
18+
flex-wrap: wrap;
19+
gap: 8px 16px;
2020
padding: ${responsiveSize(16, 20)} ${responsiveSize(16, 32)};
21-
margin-top: 16px;
2221
background-color: ${({ theme }) => theme.mediumBlue};
23-
24-
${landscapeStyle(
25-
() => css`
26-
flex-direction: row;
27-
justify-content: space-between;
28-
`
29-
)};
3022
`;
3123

3224
const StyledP = styled.p`
3325
font-size: 14px;
34-
margin-top: 0;
35-
margin-bottom: 16px;
26+
margin: 0;
3627
color: ${({ theme }) => theme.primaryBlue};
37-
${landscapeStyle(
38-
() => css`
39-
margin-bottom: 0;
40-
`
41-
)};
4228
`;
4329

4430
const StyledPolicyIcon = styled(PolicyIcon)`
@@ -51,13 +37,6 @@ const StyledPaperclipIcon = styled(PaperclipIcon)`
5137
fill: ${({ theme }) => theme.primaryBlue};
5238
`;
5339

54-
const LinkContainer = styled.div`
55-
display: flex;
56-
gap: ${responsiveSize(16, 24)};
57-
flex-wrap: wrap;
58-
align-items: center;
59-
`;
60-
6140
const StyledInternalLink = styled(InternalLink)`
6241
display: flex;
6342
gap: 4px;
@@ -82,28 +61,26 @@ interface IPolicies {
8261

8362
export const Policies: React.FC<IPolicies> = ({ disputePolicyURI, courtId, attachment }) => {
8463
return (
85-
<ShadeArea>
86-
<StyledP>Make sure you read and understand the Policies</StyledP>
87-
<LinkContainer>
88-
{!isUndefined(attachment) && !isUndefined(attachment.uri) ? (
89-
<StyledInternalLink to={`attachment/?url=${getIpfsUrl(attachment.uri)}`}>
90-
<StyledPaperclipIcon />
91-
{attachment.label ?? "Attachment"}
92-
</StyledInternalLink>
93-
) : null}
94-
{isUndefined(disputePolicyURI) ? null : (
95-
<StyledInternalLink to={`policy/attachment/?url=${getIpfsUrl(disputePolicyURI)}`}>
96-
<StyledPolicyIcon />
97-
Dispute Policy
98-
</StyledInternalLink>
99-
)}
100-
{isUndefined(courtId) ? null : (
101-
<StyledInternalLink to={`/courts/${courtId}/policy?section=description`}>
102-
<StyledPolicyIcon />
103-
Court Policy
104-
</StyledInternalLink>
105-
)}
106-
</LinkContainer>
107-
</ShadeArea>
64+
<Container>
65+
<StyledP>Policy documents:</StyledP>
66+
{!isUndefined(attachment) && !isUndefined(attachment.uri) ? (
67+
<StyledInternalLink to={`attachment/?url=${getIpfsUrl(attachment.uri)}`}>
68+
<StyledPaperclipIcon />
69+
{attachment.label ?? "Attachment"}
70+
</StyledInternalLink>
71+
) : null}
72+
{isUndefined(disputePolicyURI) ? null : (
73+
<StyledInternalLink to={`policy/attachment/?url=${getIpfsUrl(disputePolicyURI)}`}>
74+
<StyledPolicyIcon />
75+
Dispute Policy
76+
</StyledInternalLink>
77+
)}
78+
{isUndefined(courtId) ? null : (
79+
<StyledInternalLink to={`/courts/${courtId}/policy?section=description`}>
80+
<StyledPolicyIcon />
81+
Court Policy
82+
</StyledInternalLink>
83+
)}
84+
</Container>
10885
);
10986
};

web/src/components/DisputeView/DisputeInfo/DisputeInfoCard.tsx

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import React, { useMemo } from "react";
1+
import React from "react";
22
import styled, { css } from "styled-components";
33

4-
import LawBalanceIcon from "svgs/icons/law-balance.svg";
5-
6-
import { useCourtTree } from "hooks/queries/useCourtTree";
7-
84
import { landscapeStyle } from "styles/landscapeStyle";
95

106
import Field, { IField } from "components/Field";
11-
import { getCourtsPath } from "pages/Courts/CourtDetails";
127

138
import CardLabel from "../CardLabels";
149

@@ -22,12 +17,6 @@ const Container = styled.div`
2217
justify-content: flex-end;
2318
`;
2419

25-
const CourtBranchFieldContainer = styled.div`
26-
display: flex;
27-
margin-top: 16px;
28-
flex-wrap: wrap;
29-
`;
30-
3120
const RestOfFieldsContainer = styled.div<{ isOverview?: boolean }>`
3221
display: flex;
3322
flex-direction: column;
@@ -42,7 +31,6 @@ const RestOfFieldsContainer = styled.div<{ isOverview?: boolean }>`
4231
css`
4332
${landscapeStyle(
4433
() => css`
45-
margin-top: 16px;
4634
gap: 32px;
4735
flex-direction: row;
4836
flex-wrap: wrap;
@@ -56,7 +44,6 @@ const StyledField = styled(Field)`
5644
max-width: 100%;
5745
label {
5846
&.value {
59-
margin-left: 8px;
6047
overflow: hidden;
6148
text-overflow: ellipsis;
6249
text-wrap: auto;
@@ -66,36 +53,9 @@ const StyledField = styled(Field)`
6653

6754
type IDisputeInfoCard = { fieldItems: FieldItem[] } & IDisputeInfo;
6855

69-
const DisputeInfoCard: React.FC<IDisputeInfoCard> = ({
70-
isOverview,
71-
showLabels,
72-
fieldItems,
73-
court,
74-
courtId,
75-
disputeID,
76-
round,
77-
}) => {
78-
const { data } = useCourtTree();
79-
const courtPath = getCourtsPath(data?.court, courtId);
80-
const items = useMemo(
81-
() => [...(courtPath?.map((node) => ({ text: node.name, value: node.id })) ?? [])],
82-
[courtPath]
83-
);
84-
85-
const courtBranchValue = items.map((item) => item.text).join(" / ");
56+
const DisputeInfoCard: React.FC<IDisputeInfoCard> = ({ isOverview, showLabels, fieldItems, disputeID, round }) => {
8657
return (
8758
<Container>
88-
{court && courtId && isOverview && (
89-
<CourtBranchFieldContainer>
90-
<StyledField
91-
link={`/courts/${courtId}`}
92-
icon={LawBalanceIcon}
93-
name="Court Branch"
94-
value={courtBranchValue}
95-
{...{ isOverview }}
96-
/>
97-
</CourtBranchFieldContainer>
98-
)}
9959
<RestOfFieldsContainer {...{ isOverview }}>
10060
{fieldItems.map((item) =>
10161
item.display ? <StyledField key={item.name} {...(item as IField)} {...{ isOverview }} /> : null

web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const RestOfFieldsContainer = styled.div`
3030
grid-template-columns: repeat(3, min-content);
3131
justify-content: start;
3232
`;
33+
3334
const StyledField = styled(Field)<{ style?: string }>`
3435
${({ style }) => style ?? ""}
3536
`;

web/src/components/DisputeView/DisputeInfo/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const DisputeInfo: React.FC<IDisputeInfo> = ({
7676
name: "Court",
7777
value: court,
7878
link: `/courts/${courtId}`,
79-
display: !isUndefined(court) && !isUndefined(courtId) && !isOverview,
79+
display: !isUndefined(court) && !isUndefined(courtId),
8080
},
8181
{
8282
icon: RoundIcon,

0 commit comments

Comments
 (0)