Skip to content

Commit

Permalink
Show amouny bonded by you in PageDelegates
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Dec 27, 2017
1 parent eb41ea5 commit be92683
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
13 changes: 8 additions & 5 deletions app/src/renderer/components/staking/LiDelegate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ transition(name='ts-li-delegate'): div(:class='styles')
a(v-else) {{ ' ' + delegate.description.moniker }}
.value.id
span {{ delegate.id }}
.value.delegated
span {{ num.percentInt(bondedPercent) }}
.value.voting_power.num.bar
span {{ num.prettyInt(delegate.voting_power) }}
.bar(:style='vpStyles')
.value.delegated
span {{ num.percentInt(bondedPercent) }}
.value {{ delegate.commission ? num.percentInt(delegate.commission) : 'n/a' }}
.value {{ num.prettyInt(amountBonded(delegate.id)) }}
menu
btn(v-if='inCart'
icon='delete' value='Remove' size='sm' @click.native='rm(delegate)')
Expand All @@ -37,7 +37,7 @@ export default {
Btn
},
computed: {
...mapGetters(['shoppingCart', 'delegates', 'config']),
...mapGetters(['shoppingCart', 'delegates', 'config', 'committedDelegations']),
styles () {
let value = 'li-delegate'
if (this.inCart) value += ' li-delegate-active '
Expand Down Expand Up @@ -69,7 +69,10 @@ export default {
}),
methods: {
add (delegate) { this.$store.commit('addToCart', delegate) },
rm (delegate) { this.$store.commit('removeFromCart', delegate.id) }
rm (delegate) { this.$store.commit('removeFromCart', delegate.id) },
amountBonded (delegateId) {
return this.committedDelegations[delegateId]
}
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/staking/PageBond.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
ToolBar
},
computed: {
...mapGetters(['shoppingCart', 'user']),
...mapGetters(['shoppingCart', 'user', 'committedDelegations']),
reservedAtoms () {
return this.shoppingCart.reduce((sum, d) => sum + (d.reservedAtoms || 0), 0)
},
Expand Down
8 changes: 4 additions & 4 deletions app/src/renderer/components/staking/PageDelegates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ export default {
data: () => ({
query: '',
sort: {
property: 'id',
property: 'shares',
order: 'desc',
properties: [
{ id: 1, title: 'Name', value: 'description.moniker' },
{ id: 2, title: 'Public Key', value: 'id' },
{ id: 3, title: 'Bonded Atoms', value: 'voting_power' },
{ id: 4, title: 'Voting Power', value: 'shares', initial: true },
{ id: 5, title: 'Commission', value: 'commission' }
{ id: 3, title: 'Voting Power', value: 'shares', initial: true },
{ id: 4, title: 'Bonded Atoms', value: 'voting_power' },
{ id: 5, title: 'Bonded by You', value: 'bonded' }
]
}
}),
Expand Down
1 change: 1 addition & 0 deletions app/src/renderer/vuex/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const lastHeader = state => state.node.lastHeader

export const delegates = state => state.delegates
export const shoppingCart = state => state.delegation.delegates
export const committedDelegations = state => state.delegation.committedDelegates
export const user = state => state.user
export const config = state => state.config

Expand Down

0 comments on commit be92683

Please sign in to comment.