Skip to content

Commit 2d6de9d

Browse files
committed
refactor(web): case details overview file too big
1 parent 7483f1f commit 2d6de9d

File tree

4 files changed

+229
-203
lines changed

4 files changed

+229
-203
lines changed

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

-203
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import React from "react";
2+
import ReactMarkdown from "react-markdown";
3+
import styled from "styled-components";
4+
import { StyledSkeleton } from "components/StyledSkeleton";
5+
import { isUndefined } from "utils/index";
6+
7+
const QuestionAndDescription = styled.div`
8+
display: flex;
9+
flex-direction: column;
10+
> * {
11+
margin: 0px;
12+
}
13+
`;
14+
15+
const VotingOptions = styled(QuestionAndDescription)`
16+
display: flex;
17+
flex-direction: column;
18+
gap: 8px;
19+
`;
20+
21+
const Answers = styled.div`
22+
display: flex;
23+
flex-direction: column;
24+
25+
span {
26+
margin: 0px;
27+
display: flex;
28+
gap: 8px;
29+
}
30+
`;
31+
32+
export const DisputeBasicInfo: React.FC<any> = ({ disputeTemplate }) => {
33+
return (
34+
<>
35+
<h1>
36+
{isUndefined(disputeTemplate) ? (
37+
<StyledSkeleton />
38+
) : (
39+
disputeTemplate?.title ?? "The dispute's template is not correct please vote refuse to arbitrate"
40+
)}
41+
</h1>
42+
43+
<QuestionAndDescription>
44+
<ReactMarkdown>{disputeTemplate?.question}</ReactMarkdown>
45+
<ReactMarkdown>{disputeTemplate?.description}</ReactMarkdown>
46+
</QuestionAndDescription>
47+
48+
{disputeTemplate?.frontendUrl && (
49+
<a href={disputeTemplate?.frontendUrl} target="_blank" rel="noreferrer">
50+
Go to arbitrable
51+
</a>
52+
)}
53+
<VotingOptions>
54+
{disputeTemplate && <h3>Voting Options</h3>}
55+
<Answers>
56+
{disputeTemplate?.answers?.map((answer: { title: string; description: string }, i: number) => (
57+
<span key={i}>
58+
<small>Option {i + 1}:</small>
59+
<label>{answer.title}</label>
60+
</span>
61+
))}
62+
</Answers>
63+
</VotingOptions>
64+
</>
65+
);
66+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import { IPFS_GATEWAY } from "consts/index";
5+
import PolicyIcon from "svgs/icons/policy.svg";
6+
7+
const ShadeArea = styled.div`
8+
display: flex;
9+
flex-direction: column;
10+
justify-content: center;
11+
width: 100%;
12+
padding: calc(16px + (20 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875)
13+
calc(16px + (32 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
14+
margin-top: 16px;
15+
background-color: ${({ theme }) => theme.mediumBlue};
16+
> p {
17+
font-size: 14px;
18+
margin-top: 0;
19+
margin-bottom: 16px;
20+
color: ${({ theme }) => theme.primaryBlue};
21+
${landscapeStyle(
22+
() => css`
23+
margin-bottom: 0;
24+
`
25+
)};
26+
}
27+
28+
${landscapeStyle(
29+
() => css`
30+
flex-direction: row;
31+
justify-content: space-between;
32+
`
33+
)};
34+
`;
35+
36+
const StyledA = styled.a`
37+
display: flex;
38+
align-items: center;
39+
gap: 4px;
40+
> svg {
41+
width: 16px;
42+
fill: ${({ theme }) => theme.primaryBlue};
43+
}
44+
`;
45+
46+
const LinkContainer = styled.div`
47+
display: flex;
48+
gap: calc(8px + (24 - 8) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
49+
`;
50+
51+
interface IPolicies {
52+
disputePolicyURI?: string;
53+
courtId?: number;
54+
}
55+
56+
export const Policies: React.FC<IPolicies> = ({ disputePolicyURI, courtId }) => {
57+
return (
58+
<ShadeArea>
59+
<p>Make sure you read and understand the Policies</p>
60+
<LinkContainer>
61+
{disputePolicyURI && (
62+
<StyledA href={`${IPFS_GATEWAY}${disputePolicyURI}`} target="_blank" rel="noreferrer">
63+
<PolicyIcon />
64+
Dispute Policy
65+
</StyledA>
66+
)}
67+
{courtId && (
68+
<StyledA href={`#/courts/${courtId}/purpose?section=description`}>
69+
<PolicyIcon />
70+
Court Policy
71+
</StyledA>
72+
)}
73+
</LinkContainer>
74+
</ShadeArea>
75+
);
76+
};

0 commit comments

Comments
 (0)