-
Notifications
You must be signed in to change notification settings - Fork 49
refactor(web): case details overview file too big #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,66 @@ | ||||||||||||||||||||||||||||||||||||||||||
import React from "react"; | ||||||||||||||||||||||||||||||||||||||||||
import ReactMarkdown from "react-markdown"; | ||||||||||||||||||||||||||||||||||||||||||
import styled from "styled-components"; | ||||||||||||||||||||||||||||||||||||||||||
import { StyledSkeleton } from "components/StyledSkeleton"; | ||||||||||||||||||||||||||||||||||||||||||
import { isUndefined } from "utils/index"; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
const QuestionAndDescription = styled.div` | ||||||||||||||||||||||||||||||||||||||||||
display: flex; | ||||||||||||||||||||||||||||||||||||||||||
flex-direction: column; | ||||||||||||||||||||||||||||||||||||||||||
> * { | ||||||||||||||||||||||||||||||||||||||||||
margin: 0px; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
`; | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's take the margin out and make it more specific using styled components
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
const VotingOptions = styled(QuestionAndDescription)` | ||||||||||||||||||||||||||||||||||||||||||
display: flex; | ||||||||||||||||||||||||||||||||||||||||||
flex-direction: column; | ||||||||||||||||||||||||||||||||||||||||||
gap: 8px; | ||||||||||||||||||||||||||||||||||||||||||
`; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
const Answers = styled.div` | ||||||||||||||||||||||||||||||||||||||||||
display: flex; | ||||||||||||||||||||||||||||||||||||||||||
flex-direction: column; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
span { | ||||||||||||||||||||||||||||||||||||||||||
margin: 0px; | ||||||||||||||||||||||||||||||||||||||||||
display: flex; | ||||||||||||||||||||||||||||||||||||||||||
gap: 8px; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
`; | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
export const DisputeBasicInfo: React.FC<any> = ({ disputeTemplate }) => { | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's not use |
||||||||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||||||||
<> | ||||||||||||||||||||||||||||||||||||||||||
<h1> | ||||||||||||||||||||||||||||||||||||||||||
{isUndefined(disputeTemplate) ? ( | ||||||||||||||||||||||||||||||||||||||||||
<StyledSkeleton /> | ||||||||||||||||||||||||||||||||||||||||||
) : ( | ||||||||||||||||||||||||||||||||||||||||||
disputeTemplate?.title ?? "The dispute's template is not correct please vote refuse to arbitrate" | ||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||
</h1> | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
<QuestionAndDescription> | ||||||||||||||||||||||||||||||||||||||||||
<ReactMarkdown>{disputeTemplate?.question}</ReactMarkdown> | ||||||||||||||||||||||||||||||||||||||||||
<ReactMarkdown>{disputeTemplate?.description}</ReactMarkdown> | ||||||||||||||||||||||||||||||||||||||||||
</QuestionAndDescription> | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
{disputeTemplate?.frontendUrl && ( | ||||||||||||||||||||||||||||||||||||||||||
<a href={disputeTemplate?.frontendUrl} target="_blank" rel="noreferrer"> | ||||||||||||||||||||||||||||||||||||||||||
Go to arbitrable | ||||||||||||||||||||||||||||||||||||||||||
</a> | ||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have been trying to favor the following syntax on these situations (make sure to run it through the linter 😅 ):
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
<VotingOptions> | ||||||||||||||||||||||||||||||||||||||||||
{disputeTemplate && <h3>Voting Options</h3>} | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as with the previous comment, let's try the other syntax |
||||||||||||||||||||||||||||||||||||||||||
<Answers> | ||||||||||||||||||||||||||||||||||||||||||
{disputeTemplate?.answers?.map((answer: { title: string; description: string }, i: number) => ( | ||||||||||||||||||||||||||||||||||||||||||
<span key={i}> | ||||||||||||||||||||||||||||||||||||||||||
<small>Option {i + 1}:</small> | ||||||||||||||||||||||||||||||||||||||||||
<label>{answer.title}</label> | ||||||||||||||||||||||||||||||||||||||||||
</span> | ||||||||||||||||||||||||||||||||||||||||||
))} | ||||||||||||||||||||||||||||||||||||||||||
</Answers> | ||||||||||||||||||||||||||||||||||||||||||
</VotingOptions> | ||||||||||||||||||||||||||||||||||||||||||
</> | ||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from "react"; | ||
import styled, { css } from "styled-components"; | ||
import { landscapeStyle } from "styles/landscapeStyle"; | ||
import { IPFS_GATEWAY } from "consts/index"; | ||
import PolicyIcon from "svgs/icons/policy.svg"; | ||
|
||
const ShadeArea = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
width: 100%; | ||
padding: calc(16px + (20 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875) | ||
calc(16px + (32 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875); | ||
margin-top: 16px; | ||
background-color: ${({ theme }) => theme.mediumBlue}; | ||
> p { | ||
font-size: 14px; | ||
margin-top: 0; | ||
margin-bottom: 16px; | ||
color: ${({ theme }) => theme.primaryBlue}; | ||
${landscapeStyle( | ||
() => css` | ||
margin-bottom: 0; | ||
` | ||
)}; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's move this out into its own styled component |
||
|
||
${landscapeStyle( | ||
() => css` | ||
flex-direction: row; | ||
justify-content: space-between; | ||
` | ||
)}; | ||
`; | ||
|
||
const StyledA = styled.a` | ||
display: flex; | ||
align-items: center; | ||
gap: 4px; | ||
> svg { | ||
width: 16px; | ||
fill: ${({ theme }) => theme.primaryBlue}; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's take this out into its own styled component |
||
`; | ||
|
||
const LinkContainer = styled.div` | ||
display: flex; | ||
gap: calc(8px + (24 - 8) * (min(max(100vw, 375px), 1250px) - 375px) / 875); | ||
`; | ||
|
||
interface IPolicies { | ||
disputePolicyURI?: string; | ||
courtId?: number; | ||
} | ||
|
||
export const Policies: React.FC<IPolicies> = ({ disputePolicyURI, courtId }) => { | ||
return ( | ||
<ShadeArea> | ||
<p>Make sure you read and understand the Policies</p> | ||
<LinkContainer> | ||
{disputePolicyURI && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as with the previous cases, let's see how does it look using the ternary operator |
||
<StyledA href={`${IPFS_GATEWAY}${disputePolicyURI}`} target="_blank" rel="noreferrer"> | ||
<PolicyIcon /> | ||
Dispute Policy | ||
</StyledA> | ||
)} | ||
{courtId && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's try the ternary operator here too |
||
<StyledA href={`#/courts/${courtId}/purpose?section=description`}> | ||
<PolicyIcon /> | ||
Court Policy | ||
</StyledA> | ||
)} | ||
</LinkContainer> | ||
</ShadeArea> | ||
); | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.