Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Changed "votes" for "voting power" and solved issues with graphs and …
Browse files Browse the repository at this point in the history
…% when the voting power is different than "1". Removed "Powered by Aragon" on the footer
  • Loading branch information
jpaulet committed Mar 28, 2024
1 parent 71ac233 commit 0228b90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
14 changes: 11 additions & 3 deletions components/blocks/question-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export const QuestionResults = (props: QuestionsResultsProps) => {
props.results !== undefined;

const decimals = (election.meta as any)?.token?.decimals || 0;

//Calculate voting weight
let totalWeightCount = 0;
sortedChoices.map((choice: ChoiceResult, index: number) => {
totalWeightCount = (Number(totalWeightCount) + Number(choice.votes));
})
totalWeightCount = BigNumber.from(totalWeightCount)

return (
<Card isMobile={isMobile}>
{/* TITLE */}
Expand Down Expand Up @@ -123,7 +131,7 @@ export const QuestionResults = (props: QuestionsResultsProps) => {
<>
<Col hiddenSmAndDown md={2}>
<Text size="lg" weight="bold" color="dark-blue">
{getStringPercent(getPercent(choice.votes, votesWeight))}%
{getStringPercent(getPercent(choice.votes, totalWeightCount))}%
</Text>
<Text size="sm" color="dark-gray" weight="regular">
<BreakWord>
Expand All @@ -135,7 +143,7 @@ export const QuestionResults = (props: QuestionsResultsProps) => {
</Col>
<Col xs={12} md={6}>
<StyledProgressBar
value={getBarPercent(choice.votes, votesWeight)}
value={getBarPercent(choice.votes, totalWeightCount)}
size={isMobile ? 'sm' : 'md'}
style={{ background: colorsV2.neutral[100] }}
disabled={choice.votes.eq(0)}
Expand All @@ -145,7 +153,7 @@ export const QuestionResults = (props: QuestionsResultsProps) => {
<Row align="end" gutter="md">
<Col>
<Text size="lg" weight="bold" color="dark-blue">
{getStringPercent(getPercent(choice.votes, votesWeight))}%
{getStringPercent(getPercent(choice.votes, totalWeightCount))}%
</Text>
</Col>
<Col>
Expand Down
19 changes: 1 addition & 18 deletions components/pages/app/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Footer = () => {

const LINKS: HeaderLink[] = [
{
url: 'https://blog.aragon.org/vocdoni/',
url: 'https://blog.vocdoni.io/',
name: i18n.t('links.blog'),
external: true,
logged: true,
Expand Down Expand Up @@ -65,9 +65,6 @@ export const Footer = () => {
</FooterLink>
</NavItem>
))}
<AragonLink href="https://aragon.org/" passHref target="_blank">
<img src="/images/powered-aragon.svg" alt="Aragon" />
</AragonLink>
</LinksSection>
</Container>
);
Expand Down Expand Up @@ -139,20 +136,6 @@ const HomeLink = styled(Link)`
}
`;

const AragonLink = styled(Link)`
cursor: pointer;
margin-right: 70px;
& > img {
//margin-right: 5px;
height: 50px;
}
@media ${({ theme }) => theme.screenMax.mobileL} {
margin: 20px auto;
}
`;

interface HeaderLink {
name: string;
url: string;
Expand Down
2 changes: 1 addition & 1 deletion i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,6 @@
"results_question": "Question",
"vote_count_one": "",
"vote_count_other": "",
"vote_count": "{{ count }} votes"
"vote_count": "{{ count }} voting power"
}
}

0 comments on commit 0228b90

Please sign in to comment.