Skip to content

Commit 025f02f

Browse files
committed
feat(web): share juror score on x
1 parent 0ff85f8 commit 025f02f

File tree

2 files changed

+58
-5
lines changed

2 files changed

+58
-5
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
import XIcon from "svgs/socialmedia/x.svg";
4+
5+
const Container = styled.div`
6+
display: flex;
7+
flex-direction: row;
8+
align-items: center;
9+
justify-content: space-between;
10+
`;
11+
12+
const StyledTitle = styled.h1`
13+
margin-bottom: calc(16px + (48 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
14+
`;
15+
16+
const XLinkContainer = styled.div`
17+
display: flex;
18+
color: ${({ theme }) => theme.primaryBlue};
19+
margin-bottom: calc(16px + (48 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
20+
`;
21+
22+
const StyledXIcon = styled(XIcon)`
23+
fill: ${({ theme }) => theme.primaryBlue};
24+
width: 16px;
25+
height: 16px;
26+
`;
27+
28+
const StyledLink = styled.a`
29+
display: flex;
30+
border: 0px;
31+
align-items: center;
32+
gap: 8px;
33+
34+
&:hover {
35+
text-decoration: underline;
36+
}
37+
`;
38+
39+
const Header: React.FC = () => {
40+
const courtUrl = window.location.origin;
41+
const xPostText = `Hey I've been busy as a Juror on the Kleros court, check out my score: Level: 2 (Diogenes). Coherence score: 8. Be a juror with me -> ${courtUrl}`;
42+
const xShareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(xPostText)}`;
43+
44+
return (
45+
<Container>
46+
<StyledTitle>Juror Dashboard</StyledTitle>
47+
<XLinkContainer>
48+
<StyledLink href={xShareUrl} target="_blank" rel="noreferrer">
49+
<StyledXIcon /> <span>Share your juror score</span>
50+
</StyledLink>
51+
</XLinkContainer>
52+
</Container>
53+
);
54+
};
55+
56+
export default Header;

web/src/pages/Dashboard/JurorInfo/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react";
22
import styled, { css } from "styled-components";
33
import { landscapeStyle } from "styles/landscapeStyle";
44
import { Card as _Card } from "@kleros/ui-components-library";
5+
import Header from "./Header";
56
import Coherency from "./Coherency";
67
import JurorRewards from "./JurorRewards";
78
import PixelArt from "./PixelArt";
@@ -11,10 +12,6 @@ import { useUserQuery } from "queries/useUser";
1112

1213
const Container = styled.div``;
1314

14-
const Header = styled.h1`
15-
margin-bottom: calc(16px + (48 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
16-
`;
17-
1815
const Card = styled(_Card)`
1916
display: flex;
2017
flex-direction: column;
@@ -61,7 +58,7 @@ const JurorInfo: React.FC = () => {
6158

6259
return (
6360
<Container>
64-
<Header>Juror Dashboard</Header>
61+
<Header />
6562
<Card>
6663
<PixelArt level={userLevelData.level} />
6764
<Coherency

0 commit comments

Comments
 (0)