diff --git a/app/src/renderer/components/staking/LiDelegate.vue b/app/src/renderer/components/staking/LiDelegate.vue index ca9b115d20..6b548d31a7 100644 --- a/app/src/renderer/components/staking/LiDelegate.vue +++ b/app/src/renderer/components/staking/LiDelegate.vue @@ -8,21 +8,19 @@ transition(name='ts-li-delegate'): div(:class='styles') i.fa.fa-check-square-o(v-if='inCart' @click='rm(delegate)') i.fa.fa-square-o(v-else @click='add(delegate)') router-link(v-if="config.devMode" :to="{ name: 'delegate', params: { delegate: delegate.id }}") - //- | {{ delegate.keybaseID ? delegate.keybaseID : 'n/a'}} | {{ delegate.id }} a(v-else) {{ delegate.id }} .value {{ delegate.country ? delegate.country : 'n/a' }} .value.voting_power.num.bar span {{ num.prettyInt(delegate.voting_power) }} .bar(:style='vpStyles') - .value.delegated.num.bar.delegated - span {{ num.prettyInt(delegate.shares) }} - .bar(:style='sharesStyles') - .value {{ delegate.commission ? (delegate.commission * 100).toFixed(2) + '%' : 'n/a' }} + .value.delegated + span {{ num.percentInt(bondedPercent) }} + .value {{ delegate.commission ? num.percentInt(delegate.commission) : 'n/a' }} menu - btn(theme='cosmos' v-if='inCart' + btn(v-if='inCart' icon='delete' value='Remove' size='sm' @click.native='rm(delegate)') - btn(v-else='' theme='cosmos' + btn(v-else icon='check' value='Add' size='sm' @click.native='add(delegate)') @@ -55,16 +53,8 @@ export default { Math.round((this.delegate.voting_power / this.vpMax) * 100) return { width: percentage + '%' } }, - sharesMax () { - if (this.delegates) { - let richestDelegate = maxBy(this.delegates, 'shares') - return richestDelegate.shares - } else { return 0 } - }, - sharesStyles () { - let percentage = - Math.round((this.delegate.shares / this.sharesMax) * 100) - return { width: percentage + '%' } + bondedPercent () { + return this.delegate.shares / this.delegate.voting_power }, inCart () { return this.shoppingCart.find(c => c.id === this.delegate.id) diff --git a/app/src/renderer/components/staking/PageDelegates.vue b/app/src/renderer/components/staking/PageDelegates.vue index 8e2fd07f28..8d84e19fed 100644 --- a/app/src/renderer/components/staking/PageDelegates.vue +++ b/app/src/renderer/components/staking/PageDelegates.vue @@ -73,7 +73,7 @@ export default { { id: 1, title: 'Public Key', value: 'id', initial: true }, { id: 2, title: 'Country', value: 'country' }, { id: 3, title: 'Voting Power', value: 'voting_power' }, - { id: 4, title: 'Delegated Power', value: 'shares' }, + { id: 4, title: 'Bonded Power', value: 'shares' }, { id: 5, title: 'Commission', value: 'commission' } ] } diff --git a/app/src/renderer/scripts/num.js b/app/src/renderer/scripts/num.js index ebc49bcee7..c6d56054db 100644 --- a/app/src/renderer/scripts/num.js +++ b/app/src/renderer/scripts/num.js @@ -45,6 +45,8 @@ function integerize (num) { function fractionize (num) { return numeral(num).format('.00') } +function percentInt (x) { return numeral(x).format('0%') } +function percent (x) { return numeral(x).format('0.00%') } export default { usd, @@ -55,5 +57,7 @@ export default { int: integerize, frac: fractionize, short: short, - shortInt + shortInt, + percent: percent, + percentInt: percentInt } diff --git a/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap b/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap index 429c267078..8060135ac3 100644 --- a/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap +++ b/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap @@ -42,15 +42,11 @@ exports[`LiDelegate has the expected html structure 1`] = ` />
- 5,000 + 50% -