Skip to content

Commit a15a07c

Browse files
committed
feat(web): pass real info to the tweet
1 parent 78b0fd6 commit a15a07c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ const StyledLink = styled.a`
3636
}
3737
`;
3838

39-
const Header: React.FC = () => {
39+
interface IHeader {
40+
levelTitle: string;
41+
levelNumber: number;
42+
totalCoherent: number;
43+
totalResolvedDisputes: number;
44+
}
45+
46+
const Header: React.FC<IHeader> = ({ levelTitle, levelNumber, totalCoherent, totalResolvedDisputes }) => {
47+
const coherencePercentage = parseFloat(((totalCoherent / Math.max(totalResolvedDisputes, 1)) * 100).toFixed(2));
4048
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}`;
49+
const xPostText = `Hey I've been busy as a Juror on the Kleros court, check out my score: \n\nLevel: ${levelNumber} (${levelTitle})\nCoherent Votes: ${totalCoherent}/${totalResolvedDisputes}\nCoherence Percentage: ${coherencePercentage}%\n\nBe a juror with me -> ${courtUrl}`;
4250
const xShareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(xPostText)}`;
4351

4452
return (

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ const JurorInfo: React.FC = () => {
4444

4545
return (
4646
<Container>
47-
<Header />
47+
<Header
48+
levelTitle={userLevelData.title}
49+
levelNumber={userLevelData.level}
50+
totalCoherent={totalCoherent}
51+
totalResolvedDisputes={totalResolvedDisputes}
52+
/>
4853
<Card>
4954
<PixelArt level={userLevelData.level} width="189px" height="189px" />
5055
<Coherency

0 commit comments

Comments
 (0)