From 0709058e6398632d74d416d585218bf61f41afcb Mon Sep 17 00:00:00 2001 From: Outsider Date: Thu, 6 Dec 2018 19:06:02 +0900 Subject: [PATCH] match voting result value with homepage --- .../wallet-detail/ProposalListItemDetail.vue | 24 +++++++++++++++---- src/renderer/i18n/en.json | 1 + src/renderer/i18n/ko.json | 1 + 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/wallet-detail/ProposalListItemDetail.vue b/src/renderer/components/wallet-detail/ProposalListItemDetail.vue index 6b853a2..bba6b8c 100644 --- a/src/renderer/components/wallet-detail/ProposalListItemDetail.vue +++ b/src/renderer/components/wallet-detail/ProposalListItemDetail.vue @@ -34,6 +34,10 @@ {{$t('abstain')}} {{item.result_abs.toLocaleString()}} ({{votesPercentage(item.result_abs)}}%) +
+ {{$t('undecided')}} + {{undecidedCount.toLocaleString()}} ({{votesPercentage(undecidedCount)}}%) +
@@ -118,10 +122,10 @@ this.voted = await this.$store.getters.hasVotedForProposal(this.item.id, this.wallet.address); }, votesPercentage(v) { - if (!this.totalVoteCount) { + if (!this.item.result_count) { return 0; } - return ((parseInt(v, 10) / this.totalVoteCount) * 100).toFixed(1); + return ((parseInt(v, 10) / parseInt(this.item.result_count, 10)) * 100).toFixed(2); }, }, computed: { @@ -201,6 +205,9 @@ parseInt(this.item.result_no, 10) + parseInt(this.item.result_abs, 10); }, + undecidedCount() { + return this.item.result_count - this.totalVoteCount; + }, }, mounted() { this.$store.state.App.ga.send('screenview', { cd: 'bos-wallet-proposal-item-detail' }); @@ -218,11 +225,13 @@ ['agree', this.item.result_yes], ['disagree', this.item.result_no], ['abstain', this.item.result_abs], + ['undecided', this.undecidedCount], ], colors: { agree: '#1792f0', disagree: '#ed6060', - abstain: '#728395', + abstain: '#5BD76A', + undecided: '#CDD8E5', }, type: 'donut', }, @@ -461,6 +470,7 @@ .ProposalListItemDetail .chart .counts .agree { color: #1792f0; + margin-top: -20px; margin-bottom: 5px; } @@ -471,7 +481,13 @@ } .ProposalListItemDetail .chart .counts .abstain { - color: #728395; + color: #3DC04C; + margin-top: 5px; + margin-bottom: 5px; + } + + .ProposalListItemDetail .chart .counts .undecided { + color: #7C92AE; margin-top: 5px; } diff --git a/src/renderer/i18n/en.json b/src/renderer/i18n/en.json index 874a6fc..220a773 100644 --- a/src/renderer/i18n/en.json +++ b/src/renderer/i18n/en.json @@ -114,6 +114,7 @@ "agree": "Agree", "disagree": "Disagree", "abstain": "Abstain", + "undecided": "Undecided", "change my vote": "Change the vote", "there is no ongoing congress voting": "There is no ongoing Congress Voting now", "there is no closed congress voting": "There is no past proposals", diff --git a/src/renderer/i18n/ko.json b/src/renderer/i18n/ko.json index 81ca6bc..0636f7c 100644 --- a/src/renderer/i18n/ko.json +++ b/src/renderer/i18n/ko.json @@ -114,6 +114,7 @@ "agree": "찬성", "disagree": "반대", "abstain": "기권", + "undecided": "미참여", "change my vote": "투표 수정", "there is no ongoing congress voting": "진행중인 투표가 없습니다", "there is no closed congress voting": "종료된 투표가 없습니다",