From a15a07caed538cc83a144229494bde0bf7f7733d Mon Sep 17 00:00:00 2001 From: marino <102478601+kemuru@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:20:34 +0100 Subject: [PATCH] feat(web): pass real info to the tweet --- web/src/pages/Dashboard/JurorInfo/Header.tsx | 12 ++++++++++-- web/src/pages/Dashboard/JurorInfo/index.tsx | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/src/pages/Dashboard/JurorInfo/Header.tsx b/web/src/pages/Dashboard/JurorInfo/Header.tsx index f6bd112ce..5ffc27995 100644 --- a/web/src/pages/Dashboard/JurorInfo/Header.tsx +++ b/web/src/pages/Dashboard/JurorInfo/Header.tsx @@ -36,9 +36,17 @@ const StyledLink = styled.a` } `; -const Header: React.FC = () => { +interface IHeader { + levelTitle: string; + levelNumber: number; + totalCoherent: number; + totalResolvedDisputes: number; +} + +const Header: React.FC = ({ levelTitle, levelNumber, totalCoherent, totalResolvedDisputes }) => { + const coherencePercentage = parseFloat(((totalCoherent / Math.max(totalResolvedDisputes, 1)) * 100).toFixed(2)); const courtUrl = window.location.origin; - 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}`; + 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}`; const xShareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(xPostText)}`; return ( diff --git a/web/src/pages/Dashboard/JurorInfo/index.tsx b/web/src/pages/Dashboard/JurorInfo/index.tsx index 7ad1701a1..ffefa5a9d 100644 --- a/web/src/pages/Dashboard/JurorInfo/index.tsx +++ b/web/src/pages/Dashboard/JurorInfo/index.tsx @@ -44,7 +44,12 @@ const JurorInfo: React.FC = () => { return ( -
+