From 6225c1b66fe4b4c5e45b5b6dca5345af3ab818aa Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 8 Oct 2022 09:31:15 +0800 Subject: [PATCH] improve proposal display --- src/views/GovernanceProposalView.vue | 9 +-------- src/views/components/ObjectFieldComponent.vue | 20 +++++++++---------- 2 files changed, 11 insertions(+), 18 deletions(-) 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') : '-' }, }, }