{
const { t } = useTranslation();
const votes = useVotes(palletVote, id, isConvictionVote);
const [ayes, nays] = useMemo(
- () => votes
- ? Object.entries(votes).reduce<[[string, u32][], [string, u32][]]>(([ayes, nays], [accountId, vote]) => {
- if (vote.isAye) {
- ayes.push([accountId, vote.asAye]);
- } else {
- nays.push([accountId, vote.asNay]);
- }
-
- return [ayes, nays];
- }, [[], []])
- : [],
+ () => extractVotes(votes),
[votes]
);
const renderAyes = useCallback(
- () => ayes?.map(([a]) => (
-
- )),
+ () => renderMini(ayes),
[ayes]
);
const renderNays = useCallback(
- () => nays?.map(([a]) => (
-
- )),
+ () => renderMini(nays),
[nays]
);
return (
|
>
)
- : t('Aye {{count}}', { replace: { count: tally.ayes.toNumber() } })
+ : t('Aye {{count}}', { replace: { count: formatNumber(tally.ayes) } })
}
/>
>
)
- : t('Nay {{count}}', { replace: { count: tally.nays.toNumber() } })
+ : t('Nay {{count}}', { replace: { count: formatNumber(tally.nays) } })
}
/>
|