diff --git a/packages/page-referenda/src/Referenda/Vote.tsx b/packages/page-referenda/src/Referenda/Vote.tsx index 292b270853..4a901c2876 100644 --- a/packages/page-referenda/src/Referenda/Vote.tsx +++ b/packages/page-referenda/src/Referenda/Vote.tsx @@ -62,6 +62,23 @@ function Voting ({ id, isConvictionVote, isMember, members, palletVote, preimage [filteredMembers, isMember, members] ); + const [paramsAbstain, paramsAye, paramsNay] = useMemo( + () => [ + // only available on conviction votes + // FIXME: We want to do vote splits as well + isConvictionVote + ? [id, { SplitAbstain: { abstain: balance } }] + : null, + isConvictionVote + ? [id, { Standard: { balance, vote: { aye: true, conviction } } }] + : [id, true], + isConvictionVote + ? [id, { Standard: { balance, vote: { aye: false, conviction } } }] + : [id, false] + ], + [balance, conviction, id, isConvictionVote] + ); + if (!hasAccounts) { return null; } @@ -113,16 +130,22 @@ function Voting ({ id, isConvictionVote, isMember, members, palletVote, preimage )} + {isConvictionVote && paramsAbstain && ( + ('Abstain')} + onStart={toggleVoting} + params={paramsAbstain} + tx={api.tx[palletVote].vote} + /> + )} ('Vote Nay')} onStart={toggleVoting} - params={ - isConvictionVote - ? [id, { Standard: { balance, vote: { aye: false, conviction } } }] - : [id, false] - } + params={paramsNay} tx={api.tx[palletVote].vote} /> ('Vote Aye')} onStart={toggleVoting} - params={ - isConvictionVote - ? [id, { Standard: { balance, vote: { aye: true, conviction } } }] - : [id, true] - } + params={paramsAye} tx={api.tx[palletVote].vote} />