improve UX for proposal details
This commit is contained in:
parent
04e152c1fb
commit
38bbe7be5f
@ -77,11 +77,6 @@
|
|||||||
{{ $t('voting_time') }}
|
{{ $t('voting_time') }}
|
||||||
</b-td><b-td>{{ proposal.voting_start_time }} - {{ proposal.voting_end_time }}</b-td>
|
</b-td><b-td>{{ proposal.voting_start_time }} - {{ proposal.voting_end_time }}</b-td>
|
||||||
</b-tr>
|
</b-tr>
|
||||||
<b-tr v-if="proposal.type === 'cosmos-sdk/SoftwareUpgradeProposal'">
|
|
||||||
<b-td>
|
|
||||||
{{ $t('upgrade_time') }}
|
|
||||||
</b-td><b-td><flip-countdown :deadline="upgradeTime" /></b-td>
|
|
||||||
</b-tr>
|
|
||||||
<b-tr>
|
<b-tr>
|
||||||
<b-td>
|
<b-td>
|
||||||
{{ $t('proposal_type') }}
|
{{ $t('proposal_type') }}
|
||||||
@ -96,6 +91,14 @@
|
|||||||
:tablefield="proposal.contents"
|
:tablefield="proposal.contents"
|
||||||
:small="false"
|
:small="false"
|
||||||
/></div>
|
/></div>
|
||||||
|
<b-table-simple v-if="proposal.type === 'cosmos-sdk/SoftwareUpgradeProposal'">
|
||||||
|
<b-tr>
|
||||||
|
<b-td class="text-center">
|
||||||
|
{{ $t('upgrade_time') }} {{ upgradeTime }}
|
||||||
|
<flip-countdown :deadline="upgradeTime" />
|
||||||
|
</b-td>
|
||||||
|
</b-tr>
|
||||||
|
</b-table-simple>
|
||||||
</b-card-body>
|
</b-card-body>
|
||||||
<b-card-footer>
|
<b-card-footer>
|
||||||
<router-link :to="`../gov`">
|
<router-link :to="`../gov`">
|
||||||
@ -347,7 +350,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
upgradeTime() {
|
upgradeTime() {
|
||||||
if (this.proposal.type === 'cosmos-sdk/SoftwareUpgradeProposal') {
|
if (this.proposal.type === 'cosmos-sdk/SoftwareUpgradeProposal') {
|
||||||
if (Number(this.proposal?.contents.plan.height || 0) > 0 && this.latest) {
|
if (Number(this.proposal?.contents.plan.height || 0) > 0 && this.latest?.block) {
|
||||||
const blocks = Number(this.proposal.contents.plan.height) - Number(this.latest.block?.header?.height || 0)
|
const blocks = Number(this.proposal.contents.plan.height) - Number(this.latest.block?.header?.height || 0)
|
||||||
if (blocks > 0) {
|
if (blocks > 0) {
|
||||||
const endtime = dayjs().add(blocks * 6, 'second').format('YYYY-MM-DD HH:mm:ss')
|
const endtime = dayjs().add(blocks * 6, 'second').format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
@ -51,7 +51,11 @@
|
|||||||
v-else-if="typeof value[key] === 'object'"
|
v-else-if="typeof value[key] === 'object'"
|
||||||
:tablefield="value[key]"
|
:tablefield="value[key]"
|
||||||
/>
|
/>
|
||||||
<span v-else>{{ formatText(value[key]) }}</span>
|
<object-field-component
|
||||||
|
v-else-if="isObjectText(value[key])"
|
||||||
|
:tablefield="toObject(value[key])"
|
||||||
|
/>
|
||||||
|
<span v-else>{{ value[key] }}</span>
|
||||||
</b-tab>
|
</b-tab>
|
||||||
</b-tabs>
|
</b-tabs>
|
||||||
</b-td>
|
</b-td>
|
||||||
@ -102,6 +106,12 @@ export default {
|
|||||||
// }
|
// }
|
||||||
return value
|
return value
|
||||||
},
|
},
|
||||||
|
isObjectText(v) {
|
||||||
|
return String(v).startsWith('{') && String(v).endsWith('}')
|
||||||
|
},
|
||||||
|
toObject(v) {
|
||||||
|
return JSON.parse(v)
|
||||||
|
},
|
||||||
formatText: v => abbr(v, 60),
|
formatText: v => abbr(v, 60),
|
||||||
eval_value(value) {
|
eval_value(value) {
|
||||||
return Array.from(value)
|
return Array.from(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user