Skip to content

Commit

Permalink
Merge branch 'feat(web)/mobile-view-top-jurors-and-some-refactors' of…
Browse files Browse the repository at this point in the history
… github.com:kleros/kleros-v2 into feat(web)/mobile-view-top-jurors-and-some-refactors
  • Loading branch information
jaybuidl committed Oct 30, 2023
2 parents f2803cb + e5ded92 commit d4f554b
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 104 deletions.
28 changes: 13 additions & 15 deletions web/src/pages/Home/TopJurors/Header/Coherency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@ import { useWindowSize } from "react-use";
import WithHelpTooltip from "pages/Dashboard/WithHelpTooltip";

const Container = styled.div`
label {
font-size: 12px !important;
&::before {
content: "Votes";
}
display: flex;
font-size: 12px !important;
&::before {
content: "Votes";
}
color: ${({ theme }) => theme.secondaryText};
align-items: center;
${landscapeStyle(
() =>
css`
display: flex;
label {
font-size: 14px !important;
&::before {
content: "Coherent Votes";
}
font-size: 14px !important;
&::before {
content: "Coherent Votes";
}
`
)}
Expand All @@ -37,9 +34,10 @@ const Coherency: React.FC = () => {
const { width } = useWindowSize();
return (
<Container>
<WithHelpTooltip place={width > BREAKPOINT_LANDSCAPE ? "top" : "left"} tooltipMsg={coherentVotesTooltipMsg}>
<label></label>
</WithHelpTooltip>
<WithHelpTooltip
place={width > BREAKPOINT_LANDSCAPE ? "top" : "left"}
tooltipMsg={coherentVotesTooltipMsg}
></WithHelpTooltip>
</Container>
);
};
Expand Down
10 changes: 5 additions & 5 deletions web/src/pages/Home/TopJurors/Header/HowItWorks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ const Container = styled.div`
cursor: pointer;
}
label {
color: ${({ theme }) => theme.primaryBlue};
}
svg {
path {
fill: ${({ theme }) => theme.primaryBlue};
}
}
`;

const StyledLabel = styled.label`
color: ${({ theme }) => theme.primaryBlue};
`;

const HowItWorks: React.FC = () => {
const [isLevelMiniGuidesOpen, toggleIsLevelMiniGuidesOpen] = useToggle(false);
return (
<>
<Container onClick={() => toggleIsLevelMiniGuidesOpen()}>
<BookOpenIcon />
<label> How it works </label>
<StyledLabel> How it works </StyledLabel>
</Container>
{isLevelMiniGuidesOpen && <Level {...{ toggleIsLevelMiniGuidesOpen }} />}
</>
Expand Down
18 changes: 2 additions & 16 deletions web/src/pages/Home/TopJurors/Header/JurorTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
import React from "react";
import styled from "styled-components";

const Container = styled.div`
display: flex;
align-items: center;
const StyledLabel = styled.label`
width: calc(40px + (220 - 40) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
gap: 36px;
label {
font-weight: 400;
font-size: 14px;
line-height: 19px;
color: ${({ theme }) => theme.secondaryText} !important;
}
`;

const JurorTitle: React.FC = () => (
<Container>
<label>Juror</label>
</Container>
);
const JurorTitle: React.FC = () => <StyledLabel>Juror</StyledLabel>;
export default JurorTitle;
15 changes: 3 additions & 12 deletions web/src/pages/Home/TopJurors/Header/Rank.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import React from "react";
import styled from "styled-components";

const Container = styled.div`
const StyledLabel = styled.label`
width: calc(16px + (24 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
label {
&::before {
content: "#";
}
}
`;

const Rank: React.FC = () => (
<Container>
<label></label>
</Container>
);
const Rank: React.FC = () => <StyledLabel>#</StyledLabel>;

export default Rank;
25 changes: 11 additions & 14 deletions web/src/pages/Home/TopJurors/Header/Rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@ import { landscapeStyle } from "styles/landscapeStyle";
import WithHelpTooltip from "pages/Dashboard/WithHelpTooltip";

const Container = styled.div`
label {
font-size: 12px !important;
&::before {
content: "Rewards";
}
display: flex;
font-size: 12px !important;
&::before {
content: "Rewards";
}
color: ${({ theme }) => theme.secondaryText};
align-items: center;
${landscapeStyle(
() =>
css`
display: flex;
width: calc(60px + (240 - 60) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
label {
font-size: 14px !important;
&::before {
content: "Total Rewards";
}
font-size: 14px !important;
&::before {
content: "Total Rewards";
}
`
)}
Expand All @@ -35,9 +33,8 @@ const totalRewardsTooltipMsg =

const Rewards: React.FC = () => (
<Container>
<WithHelpTooltip place="top" tooltipMsg={totalRewardsTooltipMsg}>
<label></label>
</WithHelpTooltip>
<WithHelpTooltip place="top" tooltipMsg={totalRewardsTooltipMsg}></WithHelpTooltip>
</Container>
);

export default Rewards;
1 change: 1 addition & 0 deletions web/src/pages/Home/TopJurors/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const PlaceAndTitleAndRewardsAndCoherency = styled.div`
display: flex;
flex-direction: row;
gap: calc(20px + (28 - 20) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
align-items: center;
`
)}
`;
Expand Down
13 changes: 4 additions & 9 deletions web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import styled from "styled-components";
const Container = styled.div`
display: flex;
align-items: center;
label {
font-weight: 600;
color: ${({ theme }) => theme.primaryText};
}
font-weight: 600;
color: ${({ theme }) => theme.primaryText};
flex-wrap: wrap;
`;

Expand All @@ -19,10 +17,7 @@ interface ICoherency {
const Coherency: React.FC<ICoherency> = ({ totalCoherent, totalResolvedDisputes }) => {
const coherenceRatio = `${totalCoherent}/${totalResolvedDisputes}`;

return (
<Container>
<label>{coherenceRatio}</label>
</Container>
);
return <Container>{coherenceRatio}</Container>;
};

export default Coherency;
27 changes: 15 additions & 12 deletions web/src/pages/Home/TopJurors/JurorCard/HowItWorks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@ const Container = styled.div`
align-items: center;
gap: 8px;
label {
font-size: 12px !important;
${landscapeStyle(
() => css`
gap: 16px;
`
)}
`;

&::before {
content: "Lv. ";
}
const StyledLabel = styled.label`
font-size: 12px !important;
&::before {
content: "Lv. ";
}
${landscapeStyle(
() => css`
gap: 16px;
label {
font-size: 16px !important;
font-size: 16px !important;
&::before {
content: "Level ";
}
&::before {
content: "Level ";
}
`
)}
Expand All @@ -41,7 +44,7 @@ const HowItWorks: React.FC<IHowItWorks> = ({ coherenceScore }) => {

return (
<Container>
<label>{level}</label>
<StyledLabel>{level}</StyledLabel>
<PixelArt width="32px" height="32px" level={level} />
</Container>
);
Expand Down
4 changes: 4 additions & 0 deletions web/src/pages/Home/TopJurors/JurorCard/JurorTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const Container = styled.div`
gap: 8px;
align-items: center;
label {
font-size: 16px;
}
canvas {
width: 20px;
height: 20px;
Expand Down
4 changes: 0 additions & 4 deletions web/src/pages/Home/TopJurors/JurorCard/MobileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ const Container = styled.div`
align-items: center;
gap: 20px;
label {
font-size: 16px;
}
${landscapeStyle(
() => css`
display: none;
Expand Down
15 changes: 5 additions & 10 deletions web/src/pages/Home/TopJurors/JurorCard/Rank.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import styled, { css } from "styled-components";
import { landscapeStyle } from "styles/landscapeStyle";

const Container = styled.div`
label {
color: ${({ theme }) => theme.primaryText};
}
label::before {
color: ${({ theme }) => theme.primaryText};
&::before {
content: "#";
display: inline;
}
${landscapeStyle(
() => css`
width: calc(16px + (24 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
label::before {
&::before {
display: none;
}
`
Expand All @@ -26,10 +25,6 @@ interface IRank {
}

const Rank: React.FC<IRank> = ({ rank }) => {
return (
<Container>
<label>{rank}</label>
</Container>
);
return <Container>{rank}</Container>;
};
export default Rank;
16 changes: 9 additions & 7 deletions web/src/pages/Home/TopJurors/JurorCard/Rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ const Container = styled.div`
display: flex;
gap: 8px;
align-items: center;
label {
font-weight: 600;
color: ${({ theme }) => theme.primaryText};
}
flex-wrap: wrap;
${landscapeStyle(
Expand All @@ -33,6 +29,12 @@ const StyledIcon = styled.div`
}
`;

const StyledLabel = styled.label`
font-size: 16px;
font-weight: 600;
color: ${({ theme }) => theme.primaryText};
`;

interface IRewards {
address: string;
}
Expand All @@ -45,10 +47,10 @@ const Rewards: React.FC<IRewards> = ({ address }) => {

return (
<Container>
<label>{ethReward}</label>
<StyledLabel>{ethReward}</StyledLabel>
<StyledIcon as={EthIcon} />
<label>+</label>
<label>{pnkReward}</label>
<StyledLabel>+</StyledLabel>
<StyledLabel>{pnkReward}</StyledLabel>
<StyledIcon as={PnkIcon} />
</Container>
);
Expand Down

0 comments on commit d4f554b

Please sign in to comment.