improve UI/UX

This commit is contained in:
liangping 2021-09-11 17:13:26 +08:00
parent 70ddca4693
commit 08ecad1c27
6 changed files with 98 additions and 18 deletions

View File

@ -221,12 +221,12 @@ const chainAPI = class ChainFetch {
return this.get(`/cosmos/distribution/v1beta1/delegators/${address}/validators`).then(data => commonProcess(data)) return this.get(`/cosmos/distribution/v1beta1/delegators/${address}/validators`).then(data => commonProcess(data))
} }
async getStakingDelegations(address) { async getStakingDelegations(address, config = null) {
return this.get(`/cosmos/staking/v1beta1/delegations/${address}`).then(data => commonProcess(data)) return this.get(`/cosmos/staking/v1beta1/delegations/${address}`, config).then(data => commonProcess(data))
} }
async getStakingRedelegations(address) { async getStakingRedelegations(address, config = null) {
return this.get(`/cosmos/staking/v1beta1/delegators/${address}/redelegations`).then(data => commonProcess(data)) return this.get(`/cosmos/staking/v1beta1/delegators/${address}/redelegations`, config).then(data => commonProcess(data))
} }
async getStakingUnbonding(address) { async getStakingUnbonding(address) {

View File

@ -58,7 +58,9 @@
<b-tr> <b-tr>
<b-td> <b-td>
{{ $t('proposal_proposer') }} {{ $t('proposal_proposer') }}
</b-td><b-td>{{ formatAddress(proposer.proposer) }} </b-td> </b-td><b-td><router-link :to="`../account/${proposer.proposer}`">
{{ formatAddress(proposer.proposer) }}
</router-link> </b-td>
</b-tr> </b-tr>
<b-tr> <b-tr>
<b-td> <b-td>
@ -176,7 +178,13 @@
:fields="votes_fields" :fields="votes_fields"
:items="votes.votes" :items="votes.votes"
striped striped
/> >
<template #cell(voter)="data">
<router-link :to="`../account/${data.item.voter}`">
{{ formatAddress(data.item.voter) }}
</router-link>
</template>
</b-table>
<b-card <b-card
v-if="next" v-if="next"
class="addzone text-center" class="addzone text-center"
@ -199,7 +207,13 @@
:items="deposits" :items="deposits"
:fields="deposit_fields" :fields="deposit_fields"
striped striped
/> >
<template #cell(depositor)="data">
<router-link :to="`../account/${data.item.depositor}`">
{{ formatAddress(data.item.depositor) }}
</router-link>
</template>
</b-table>
</b-card-body> </b-card-body>
<b-card-footer> <b-card-footer>
<router-link :to="`../gov`"> <router-link :to="`../gov`">
@ -272,12 +286,16 @@ export default {
formatter: value => { formatter: value => {
switch (value) { switch (value) {
case 1: case 1:
case 'VOTE_OPTION_YES':
return 'Yes' return 'Yes'
case 2: case 2:
case 'VOTE_OPTION_ABSTAIN':
return 'Abstain' return 'Abstain'
case 3: case 3:
case 'VOTE_OPTION_NO':
return 'No' return 'No'
case 4: case 4:
// case 'VOTE_OPTION_NO_WITH':
return 'No With Veto' return 'No With Veto'
default: default:
return value return value

View File

@ -24,7 +24,9 @@
<h6 class="mb-0"> <h6 class="mb-0">
Account Address Account Address
</h6> </h6>
<router-link :to="`../account/${accountAddress}`">
<small>{{ accountAddress }}</small> <small>{{ accountAddress }}</small>
</router-link>
</b-media-body> </b-media-body>
</b-media> </b-media>
<b-media <b-media
@ -47,7 +49,7 @@
<h6 class="mb-0"> <h6 class="mb-0">
Validator Address Validator Address
</h6> </h6>
<small>{{ operatorAddress }}</small> <small @click="copy(operatorAddress)">{{ operatorAddress }}</small>
</b-media-body> </b-media-body>
</b-media> </b-media>
<b-media <b-media
@ -70,7 +72,7 @@
<h6 class="mb-0"> <h6 class="mb-0">
Consensus Public Address Consensus Public Address
</h6> </h6>
<small>{{ consensusPubkey }}</small> <small @click="copy(consensusPubkey)">{{ consensusPubkey }}</small>
</b-media-body> </b-media-body>
</b-media> </b-media>
<b-media <b-media
@ -93,7 +95,7 @@
<h6 class="mb-0"> <h6 class="mb-0">
Hex Address Hex Address
</h6> </h6>
<small>{{ hexAddress }}</small> <small @click="copy(hexAddress)">{{ hexAddress }}</small>
</b-media-body> </b-media-body>
</b-media> </b-media>
</b-card> </b-card>
@ -104,6 +106,8 @@ import {
BCard, BAvatar, BMedia, BMediaAside, BMediaBody, VBTooltip, BCard, BAvatar, BMedia, BMediaAside, BMediaBody, VBTooltip,
} from 'bootstrap-vue' } from 'bootstrap-vue'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
export default { export default {
components: { components: {
BCard, BCard,
@ -111,6 +115,8 @@ export default {
BMedia, BMedia,
BMediaAside, BMediaAside,
BMediaBody, BMediaBody,
// eslint-disable-next-line vue/no-unused-components
ToastificationContent,
}, },
directives: { directives: {
'b-tooltip': VBTooltip, 'b-tooltip': VBTooltip,
@ -133,6 +139,28 @@ export default {
default: '-', default: '-',
}, },
}, },
methods: {
copy(v) {
this.$copyText(v).then(() => {
this.$toast({
component: ToastificationContent,
props: {
title: 'Address copied',
icon: 'BellIcon',
},
})
}, e => {
this.$toast({
component: ToastificationContent,
props: {
title: `Failed to copy address! ${e}`,
icon: 'BellIcon',
variant: 'danger',
},
})
})
},
},
} }
</script> </script>

View File

@ -60,7 +60,7 @@
rounded rounded
> >
<feather-icon <feather-icon
icon="DollarSignIcon" icon="DiscIcon"
size="18" size="18"
/> />
</b-avatar> </b-avatar>
@ -78,7 +78,7 @@
rounded rounded
> >
<feather-icon <feather-icon
icon="SmileIcon" icon="DivideCircleIcon"
size="18" size="18"
/> />
</b-avatar> </b-avatar>

View File

@ -112,7 +112,10 @@
size="sm" size="sm"
class="mr-25" class="mr-25"
> >
Delegate <feather-icon
icon="PlusIcon"
class="d-md-none"
/><small class="d-none d-md-block">Delegate</small>
</b-button> </b-button>
<b-button <b-button
v-if="delegations" v-if="delegations"
@ -120,7 +123,10 @@
variant="primary" variant="primary"
size="sm" size="sm"
> >
Withdraw <feather-icon
icon="MinusIcon"
class="d-md-none"
/><small class="d-none d-md-block"> Withdraw</small>
</b-button> </b-button>
</div> </div>
</b-card-header> </b-card-header>

View File

@ -76,8 +76,11 @@
/> />
<h3>${{ formatBalance(balances[acc.addr]) }}</h3> <h3>${{ formatBalance(balances[acc.addr]) }}</h3>
</div> </div>
<small class="pl-1 float-right text-muted text-overflow "> <small
{{ acc.addr }} class="pl-1 float-right text-muted text-overflow "
@click="copy(acc.addr)"
>
{{ formatAddr(acc.addr) }}
</small> </small>
</b-col> </b-col>
</b-row> </b-row>
@ -148,9 +151,9 @@ import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
import { import {
formatTokenAmount, formatTokenDenom, getLocalAccounts, getLocalChains, formatTokenAmount, formatTokenDenom, getLocalAccounts, getLocalChains,
} from '@/libs/data' } from '@/libs/data'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
import UserAccountImportAddress from './UserAccountImportAddress.vue' import UserAccountImportAddress from './UserAccountImportAddress.vue'
import OperationTransferComponent from './OperationTransferComponent.vue' import OperationTransferComponent from './OperationTransferComponent.vue'
// import { SigningCosmosClient } from '@cosmjs/launchpad'
export default { export default {
components: { components: {
@ -168,6 +171,8 @@ export default {
UserAccountImportAddress, UserAccountImportAddress,
FeatherIcon, FeatherIcon,
OperationTransferComponent, OperationTransferComponent,
// eslint-disable-next-line vue/no-unused-components
ToastificationContent,
}, },
directives: { directives: {
'b-modal': VBModal, 'b-modal': VBModal,
@ -235,6 +240,9 @@ export default {
formatAmount(v) { formatAmount(v) {
return formatTokenAmount(v) return formatTokenAmount(v)
}, },
formatAddr(v) {
return v.substring(0, 10).concat('...', v.substring(v.length - 10))
},
formatCurrency(amount, denom) { formatCurrency(amount, denom) {
const qty = this.formatAmount(amount) const qty = this.formatAmount(amount)
const d2 = this.formatDenom(denom) const d2 = this.formatDenom(denom)
@ -265,6 +273,26 @@ export default {
}) })
localStorage.setItem('accounts', JSON.stringify(this.accounts)) localStorage.setItem('accounts', JSON.stringify(this.accounts))
}, },
copy(v) {
this.$copyText(v).then(() => {
this.$toast({
component: ToastificationContent,
props: {
title: 'Address copied',
icon: 'BellIcon',
},
})
}, e => {
this.$toast({
component: ToastificationContent,
props: {
title: `Failed to copy address! ${e}`,
icon: 'BellIcon',
variant: 'danger',
},
})
})
},
}, },
} }
</script> </script>