diff --git a/web/src/hooks/queries/useVotingHistory.ts b/web/src/hooks/queries/useVotingHistory.ts index e9d0e5ae3..4991412dd 100644 --- a/web/src/hooks/queries/useVotingHistory.ts +++ b/web/src/hooks/queries/useVotingHistory.ts @@ -27,6 +27,7 @@ const votingHistoryQuery = graphql(` } vote { ... on ClassicVote { + commited justification { choice reference diff --git a/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/AccordionTitle.tsx b/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/AccordionTitle.tsx index 9db36ebda..b10866975 100644 --- a/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/AccordionTitle.tsx +++ b/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/AccordionTitle.tsx @@ -42,10 +42,22 @@ const VoteStatus: React.FC<{ choice?: string; period: string; answers: Answer[]; + commited: boolean; isActiveRound: boolean; -}> = ({ choice, period, answers, isActiveRound }) => { + hiddenVotes: boolean; +}> = ({ choice, period, answers, isActiveRound, commited, hiddenVotes }) => { + if (hiddenVotes) { + if (!commited && (isActiveRound ? ["vote", "appeal", "execution"].includes(period) : true)) + return Did not commit vote ; + + if (["evidence", "commit"].includes(period)) + return {commited ? "Vote committed" : "Pending vote commitment"}; + } + + // not voted if (isUndefined(choice) && (isActiveRound ? ["appeal", "execution"].includes(period) : true)) return Did not vote; + return ( {isUndefined(choice) ? "Pending Vote" : {getVoteChoice(parseInt(choice), answers)}} @@ -60,14 +72,16 @@ const AccordionTitle: React.FC<{ period: string; answers: Answer[]; isActiveRound: boolean; -}> = ({ juror, choice, voteCount, period, answers, isActiveRound }) => { + commited: boolean; + hiddenVotes: boolean; +}> = ({ juror, choice, voteCount, period, answers, isActiveRound, commited, hiddenVotes }) => { return ( {shortenAddress(juror)} - + {voteCount} vote{voteCount > 1 && "s"} diff --git a/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx b/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx index b1d121de9..d385532f9 100644 --- a/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx +++ b/web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx @@ -95,9 +95,10 @@ interface IVotesAccordion { period: string; answers: Answer[]; isActiveRound: boolean; + hiddenVotes: boolean; } -const VotesAccordion: React.FC = ({ drawnJurors, period, answers, isActiveRound }) => { +const VotesAccordion: React.FC = ({ drawnJurors, period, answers, isActiveRound, hiddenVotes }) => { const accordionItems = useMemo(() => { return drawnJurors .map((drawnJuror) => @@ -111,6 +112,8 @@ const VotesAccordion: React.FC = ({ drawnJurors, period, answer period={period} answers={answers} isActiveRound={isActiveRound} + commited={Boolean(drawnJuror.vote.commited)} + hiddenVotes={hiddenVotes} /> ), body: ( @@ -124,7 +127,7 @@ const VotesAccordion: React.FC = ({ drawnJurors, period, answer : null ) .filter((item) => item !== null); - }, [drawnJurors, period, answers, isActiveRound]); + }, [drawnJurors, period, answers, isActiveRound, hiddenVotes]); return ( <> @@ -146,6 +149,8 @@ const VotesAccordion: React.FC = ({ drawnJurors, period, answer period={period} answers={answers} isActiveRound={isActiveRound} + hiddenVotes={hiddenVotes} + commited={Boolean(drawnJuror.vote?.commited)} /> ) diff --git a/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx b/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx index 8cb133279..402c4f3e8 100644 --- a/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx +++ b/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx @@ -116,6 +116,7 @@ const VotingHistory: React.FC<{ arbitrable?: `0x${string}`; isQuestion: boolean period={disputeData?.dispute?.period} answers={answers} isActiveRound={localRounds?.length - 1 === currentTab} + hiddenVotes={Boolean(disputeData?.dispute?.court.hiddenVotes)} /> ) : (