Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jordan/464 sorts #549

Merged
merged 5 commits into from
Mar 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// unify spacing in objects
'object-curly-spacing': ["error", "always"],
'object-curly-newline': ["error", {
'object-curly-newline': ["error", {
"ObjectExpression": { "multiline": true, "minProperties": 3 },
"ImportDeclaration": "never"
}]
Expand Down
17 changes: 10 additions & 7 deletions app/src/renderer/components/staking/LiDelegate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
.li-delegate__value.number_of_votes.num.bar
span {{ num.prettyInt(delegate.voting_power) }}
.bar(:style='vpStyles')
.li-delegate__value.bonded_by_you
span {{ bondedByYou }}
.li-delegate__value.your-votes
span {{ yourVotes }}
.li-delegate__value.status
span {{ delegateType }}
template(v-if="userCanDelegate")
.li-delegate__value.checkbox(v-if="bondedByYou > 0")
.li-delegate__value.checkbox(v-if="yourVotes > 0")
i.material-icons lock
.li-delegate__value.checkbox#remove-from-cart(v-else-if="inCart" @click='rm(delegate)')
i.material-icons check_box
Expand All @@ -33,12 +33,15 @@ export default {
components: { Btn },
computed: {
...mapGetters(['shoppingCart', 'delegates', 'config', 'committedDelegations', 'user']),
bondedByYou () {
return this.num.prettyInt(this.committedDelegations[this.delegate.id])
yourVotes () {
let yourVotes = this.num.prettyInt(this.committedDelegations[this.delegate.id])
this.delegate.your_votes = yourVotes

return yourVotes
},
styles () {
let value = ''
if (this.inCart || this.bondedByYou > 0) value += 'li-delegate-active '
if (this.inCart || this.yourVotes > 0) value += 'li-delegate-active '
if (this.delegate.isValidator) value += 'li-delegate-validator '
return value
},
Expand Down Expand Up @@ -84,7 +87,7 @@ export default {
}
},
watch: {
bondedByYou (newVal, oldVal) {
yourVotes (newVal, oldVal) {
if (newVal > 0) {
this.$store.commit('addToCart', this.delegate)
}
Expand Down
23 changes: 14 additions & 9 deletions app/src/renderer/components/staking/PageDelegates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ page(title='Validators and Candidates')

<script>
import { mapGetters } from 'vuex'
import { includes, orderBy } from 'lodash'
import { includes, orderBy, forEach } from 'lodash'
import Mousetrap from 'mousetrap'
import LiDelegate from 'staking/LiDelegate'
import Btn from '@nylira/vue-button'
Expand Down Expand Up @@ -64,11 +64,16 @@ export default {
},
filteredDelegates () {
let query = this.filters.delegates.search.query
let list = orderBy(this.delegates.delegates, [this.sort.property], [this.sort.order])

forEach(this.delegates.delegates, function (v) {
v.small_moniker = v.moniker.toLowerCase()
})
let delegates = orderBy(this.delegates.delegates, [this.sort.property], [this.sort.order])

if (this.filters.delegates.search.visible) {
return list.filter(i => includes(JSON.stringify(i).toLowerCase(), query.toLowerCase()))
return delegates.filter(i => includes(JSON.stringify(i).toLowerCase(), query.toLowerCase()))
} else {
return list
return delegates
}
},
userCanDelegate () {
Expand All @@ -82,22 +87,22 @@ export default {
order: 'desc',
properties: [
{
title: 'Name', value: 'description.moniker', class: 'name'
title: 'Name', value: 'small_moniker', class: 'name'
},
{
title: '% of Vote', value: 'shares', class: 'percent_of_vote'
},
{
title: 'Total Votes', value: 'voting_power', class: 'number_of_votes'
title: 'Total Votes', value: 'voting_power', class: 'voting_power'
},
{
title: 'Your Votes', value: 'bonded', class: 'bonded_by_you'
title: 'Your Votes', value: 'your_votes', class: 'your-votes'
},
{
title: 'Status', value: 'status', class: 'status'
title: 'Status', value: 'isValidator', class: 'status'
},
{
title: '', value: '', class: 'action'
title: '', value: '', class: 'action hidden'
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/renderer/components/staking/PanelSort.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export default {
&.action
flex 0.5

&.hidden
visibility hidden

@media screen and (max-width: 768px)
.sort-by
&.id
Expand Down
Loading