-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): mobile version top jurors + bunch of code refactors
- Loading branch information
Showing
16 changed files
with
308 additions
and
137 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,46 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import styled, { css } from "styled-components"; | ||
import { BREAKPOINT_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle"; | ||
import { useWindowSize } from "react-use"; | ||
import WithHelpTooltip from "pages/Dashboard/WithHelpTooltip"; | ||
|
||
const Container = styled.div``; | ||
const Container = styled.div` | ||
label { | ||
font-size: 12px !important; | ||
&::before { | ||
content: "Votes"; | ||
} | ||
} | ||
${landscapeStyle( | ||
() => | ||
css` | ||
display: flex; | ||
label { | ||
font-size: 14px !important; | ||
&::before { | ||
content: "Coherent Votes"; | ||
} | ||
} | ||
` | ||
)} | ||
`; | ||
|
||
const coherentVotesTooltipMsg = | ||
"This is the ratio of coherent votes made by a juror: " + | ||
"the number in the left is the number of times where the juror " + | ||
"voted coherently and the number in the right is the total number of times " + | ||
"the juror voted"; | ||
|
||
const Coherency: React.FC = () => ( | ||
<Container> | ||
<WithHelpTooltip place="top" tooltipMsg={coherentVotesTooltipMsg}> | ||
<label> Coherent Votes </label> | ||
</WithHelpTooltip> | ||
</Container> | ||
); | ||
const Coherency: React.FC = () => { | ||
const { width } = useWindowSize(); | ||
return ( | ||
<Container> | ||
<WithHelpTooltip place={width > BREAKPOINT_LANDSCAPE ? "top" : "left"} tooltipMsg={coherentVotesTooltipMsg}> | ||
<label></label> | ||
</WithHelpTooltip> | ||
</Container> | ||
); | ||
}; | ||
export default Coherency; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from "react"; | ||
import { landscapeStyle } from "styles/landscapeStyle"; | ||
import styled, { css } from "styled-components"; | ||
import Rank from "./Rank"; | ||
import JurorTitle from "./JurorTitle"; | ||
import Rewards from "./Rewards"; | ||
import Coherency from "./Coherency"; | ||
import HowItWorks from "./HowItWorks"; | ||
|
||
const Container = styled.div` | ||
display: none; | ||
justify-content: space-between; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
background-color: ${({ theme }) => theme.whiteBackground}; | ||
border: 1px solid ${({ theme }) => theme.stroke}; | ||
border-top: none; | ||
align-items: center; | ||
padding: 15.55px 32px; | ||
label { | ||
font-size: 16px; | ||
} | ||
${landscapeStyle( | ||
() => css` | ||
display: flex; | ||
` | ||
)} | ||
`; | ||
|
||
const PlaceAndTitleAndRewardsAndCoherency = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
gap: calc(20px + (28 - 20) * (min(max(100vw, 375px), 1250px) - 375px) / 875); | ||
`; | ||
|
||
interface IDesktopCard { | ||
rank: number; | ||
address: string; | ||
totalCoherent: number; | ||
totalResolvedDisputes: number; | ||
coherenceScore: number; | ||
} | ||
|
||
const DesktopCard: React.FC<IDesktopCard> = ({ | ||
rank, | ||
address, | ||
totalCoherent, | ||
totalResolvedDisputes, | ||
coherenceScore, | ||
}) => { | ||
return ( | ||
<Container> | ||
<PlaceAndTitleAndRewardsAndCoherency> | ||
<Rank rank={rank} /> | ||
<JurorTitle address={address} /> | ||
<Rewards address={address} /> | ||
<Coherency totalCoherent={totalCoherent} totalResolvedDisputes={totalResolvedDisputes} /> | ||
</PlaceAndTitleAndRewardsAndCoherency> | ||
<HowItWorks coherenceScore={coherenceScore} /> | ||
</Container> | ||
); | ||
}; | ||
export default DesktopCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.