From 6373336d6e8cd6628b3f1b37e5dfb9197a706b15 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 6 Sep 2021 15:30:17 +0800 Subject: [PATCH] improve UX --- src/libs/fetch.js | 7 +- src/views/GovernanceProposalView.vue | 2 +- src/views/OperationDelegateComponent.vue | 1 + src/views/OperationRedelegateComponent.vue | 1 + src/views/OperationTransferComponent.vue | 1 + src/views/OperationUnbondComponent.vue | 1 + .../OperationWithdrawCommissionComponent.vue | 379 ++++++++++++++++++ src/views/OperationWithdrawComponent.vue | 2 + src/views/StakingRewardComponent.vue | 62 +-- src/views/StakingValidator.vue | 6 +- 10 files changed, 415 insertions(+), 47 deletions(-) create mode 100644 src/views/OperationWithdrawCommissionComponent.vue diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 2b3c9d34..768c99bf 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -169,8 +169,11 @@ const chainAPI = class ChainFetch { }) } - async getGovernanceVotes(pid) { - return this.get(`/gov/proposals/${pid}/votes`).then(data => commonProcess(data).map(d => new Votes().init(d))) + async getGovernanceVotes(pid, offset = 0, limit = 50) { + if (compareVersions(this.config.sdk_version, '0.40') < 0) { + return this.get(`/gov/proposals/${pid}/votes`).then(data => commonProcess(data).map(d => new Votes().init(d))) + } + return this.get(`/cosmos/gov/v1beta1/proposals/${pid}/votes?pagination.offset=${offset}&pagination.limit=${limit}`).then(data => data.votes.map(d => new Votes().init(d))) } async getGovernanceList() { diff --git a/src/views/GovernanceProposalView.vue b/src/views/GovernanceProposalView.vue index 3c1a8d61..476bf4c3 100644 --- a/src/views/GovernanceProposalView.vue +++ b/src/views/GovernanceProposalView.vue @@ -109,7 +109,7 @@ diff --git a/src/views/OperationDelegateComponent.vue b/src/views/OperationDelegateComponent.vue index f329e00b..93b72259 100644 --- a/src/views/OperationDelegateComponent.vue +++ b/src/views/OperationDelegateComponent.vue @@ -7,6 +7,7 @@ title="Delegate Token" hide-header-close scrollable + :ok-disabled="!selectedAddress" @hidden="resetModal" @ok="handleOk" @show="loadBalance" diff --git a/src/views/OperationRedelegateComponent.vue b/src/views/OperationRedelegateComponent.vue index 01ca70fa..d2897ce8 100644 --- a/src/views/OperationRedelegateComponent.vue +++ b/src/views/OperationRedelegateComponent.vue @@ -7,6 +7,7 @@ title="Redelegate Token" hide-header-close scrollable + :ok-disabled="!selectedAddress" @hidden="resetModal" @ok="handleOk" @show="loadBalance" diff --git a/src/views/OperationTransferComponent.vue b/src/views/OperationTransferComponent.vue index 57668fbd..b08269da 100644 --- a/src/views/OperationTransferComponent.vue +++ b/src/views/OperationTransferComponent.vue @@ -7,6 +7,7 @@ title="Transfer Tokens" hide-header-close scrollable + :ok-disabled="!address" @hidden="resetModal" @ok="handleOk" @show="loadBalance" diff --git a/src/views/OperationUnbondComponent.vue b/src/views/OperationUnbondComponent.vue index 8f5816a1..c1a4e681 100644 --- a/src/views/OperationUnbondComponent.vue +++ b/src/views/OperationUnbondComponent.vue @@ -7,6 +7,7 @@ title="Unbond Token" hide-header-close scrollable + :ok-disabled="!selectedAddress" @hidden="resetModal" @ok="handleOk" @show="loadBalance" diff --git a/src/views/OperationWithdrawCommissionComponent.vue b/src/views/OperationWithdrawCommissionComponent.vue new file mode 100644 index 00000000..e59b2bb4 --- /dev/null +++ b/src/views/OperationWithdrawCommissionComponent.vue @@ -0,0 +1,379 @@ + + + diff --git a/src/views/OperationWithdrawComponent.vue b/src/views/OperationWithdrawComponent.vue index cabebec8..83fc8b67 100644 --- a/src/views/OperationWithdrawComponent.vue +++ b/src/views/OperationWithdrawComponent.vue @@ -7,6 +7,8 @@ title="Withdraw Rewards" hide-header-close scrollable + + :ok-disabled="!address" @hidden="resetModal" @ok="handleOk" @show="loadBalance" diff --git a/src/views/StakingRewardComponent.vue b/src/views/StakingRewardComponent.vue index cb27face..ad085254 100644 --- a/src/views/StakingRewardComponent.vue +++ b/src/views/StakingRewardComponent.vue @@ -6,13 +6,17 @@ Outstanding Rewards - +
+
@@ -78,6 +86,7 @@ import { BCard, BCardHeader, BCardTitle, BCardBody, BMediaBody, BMedia, BMediaAside, BAvatar, } from 'bootstrap-vue' +import OperationWithdrawCommissionComponent from './OperationWithdrawCommissionComponent.vue' export default { components: { @@ -89,57 +98,24 @@ export default { BMedia, BMediaAside, BAvatar, + OperationWithdrawCommissionComponent, }, props: { data: { type: Object, required: true, }, + validator: { + type: String, + required: true, + }, + address: { + type: String, + required: true, + }, }, data() { return { - transactionData: [ - { - mode: 'Wallet', - types: 'Starbucks', - avatar: 'PocketIcon', - avatarVariant: 'light-primary', - payment: '-$74', - deduction: true, - }, - { - mode: 'Bank Transfer', - types: 'Add Money', - avatar: 'CheckIcon', - avatarVariant: 'light-success', - payment: '+$480', - deduction: false, - }, - { - mode: 'Paypal', - types: 'Add Money', - avatar: 'DollarSignIcon', - avatarVariant: 'light-danger', - payment: '+$480', - deduction: false, - }, - { - mode: 'Mastercard', - types: 'Ordered Food', - avatar: 'CreditCardIcon', - avatarVariant: 'light-warning', - payment: '-$23', - deduction: true, - }, - { - mode: 'Transfer', - types: 'Refund', - avatar: 'TrendingUpIcon', - avatarVariant: 'light-info', - payment: '+$98', - deduction: false, - }, - ], } }, methods: { diff --git a/src/views/StakingValidator.vue b/src/views/StakingValidator.vue index 4b028589..d1c53f28 100644 --- a/src/views/StakingValidator.vue +++ b/src/views/StakingValidator.vue @@ -227,7 +227,11 @@ lg="4" md="12" > - +