diff --git a/src/libs/data/proposal.js b/src/libs/data/proposal.js index 6b6c1242..a899ebb3 100644 --- a/src/libs/data/proposal.js +++ b/src/libs/data/proposal.js @@ -23,10 +23,6 @@ export default class Proposal { this.id = element.proposal_id || element.id this.status = element.status - this.type = element.content.type - if (element.content['@type']) { - this.type = element.content['@type'] - } this.tally = new ProposalTally().init(element.final_tally_result, total) this.submit_time = element.submit_time this.voting_end_time = element.voting_end_time @@ -37,6 +33,10 @@ export default class Proposal { if (this.contents) { this.title = this.contents.title this.description = this.contents.description + this.type = element.content.type + if (element.content['@type']) { + this.type = element.content['@type'] + } } return this } diff --git a/src/views/Block.vue b/src/views/Block.vue index d7c2be38..3b0e08af 100644 --- a/src/views/Block.vue +++ b/src/views/Block.vue @@ -1,6 +1,16 @@ diff --git a/src/views/GovernanceProposalView.vue b/src/views/GovernanceProposalView.vue index 46c7d357..bea06b2c 100644 --- a/src/views/GovernanceProposalView.vue +++ b/src/views/GovernanceProposalView.vue @@ -49,14 +49,7 @@ > - - {{ $t('proposal_id') }} - {{ proposal.id }} - - - + {{ $t('proposal_proposer') }} {{ formatAddress(proposer.proposer) }} diff --git a/src/views/components/ObjectFieldComponent.vue b/src/views/components/ObjectFieldComponent.vue index 19d82694..c6972245 100644 --- a/src/views/components/ObjectFieldComponent.vue +++ b/src/views/components/ObjectFieldComponent.vue @@ -15,7 +15,7 @@ - {{ name }} + {{ formatTitle(name) }} {{ formatTokens( value ) }} @@ -37,13 +37,12 @@
{{ value[key] }}
@@ -71,7 +70,7 @@
{{ value }}
@@ -135,6 +134,7 @@ export default { // } return value }, + formatTitle: v => v.replaceAll('_', ' '), isObjectText(v) { return String(v).startsWith('{') && String(v).endsWith('}') }, @@ -146,16 +146,16 @@ export default { return Array.from(value) }, isTokenField(value) { - return isToken(value) + return value ? isToken(value) : false }, isHex(value) { - return isHexAddress(value) + return value ? isHexAddress(value) : false }, formatHexAddress(v) { return getStakingValidatorByHex(this.$http.config.chain_name, v) }, isArrayText(value) { - return isStringArray(value) + return value ? isStringArray(value) : false }, formatTokens(value) { return tokenFormatter(value) @@ -165,7 +165,7 @@ export default { if (percentage.test(value)) { return `${percent(value)}%` } - return value.replace(/(?:\\[rn])+/g, '\n') + return value ? value.replace(/(?:\\[rn])+/g, '\n') : '-' }, }, }