From eaac3b295affa3caf8ac2c548861b349f655be51 Mon Sep 17 00:00:00 2001
From: liangping <18786721@qq.com>
Date: Sun, 8 Aug 2021 13:34:00 +0800
Subject: [PATCH] Fixed some issues
---
src/libs/data/data.js | 13 +++++++++++--
src/views/Governance.vue | 1 +
src/views/Staking.vue | 2 +-
src/views/Summary.vue | 12 ++----------
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/libs/data/data.js b/src/libs/data/data.js
index 5c353eba..88c0ea84 100644
--- a/src/libs/data/data.js
+++ b/src/libs/data/data.js
@@ -1,11 +1,20 @@
-import dayjs from 'dayjs'
-import relativeTime from 'dayjs/plugin/relativeTime'
import {
Bech32, fromBase64, fromHex, toHex,
} from '@cosmjs/encoding'
import { sha256 } from '@cosmjs/crypto'
+import dayjs from 'dayjs'
+import duration from 'dayjs/plugin/duration'
+import relativeTime from 'dayjs/plugin/relativeTime'
+import localeData from 'dayjs/plugin/localeData'
+
+dayjs.extend(duration)
dayjs.extend(relativeTime)
+dayjs.extend(localeData)
+
+export function toDuration(value) {
+ return dayjs.duration(value).humanize()
+}
export function toDay(time, format = 'long') {
if (format === 'long') {
diff --git a/src/views/Governance.vue b/src/views/Governance.vue
index a7276bf6..a044abd6 100644
--- a/src/views/Governance.vue
+++ b/src/views/Governance.vue
@@ -242,6 +242,7 @@ section {
.gov-wrapper .gov {
padding: .5rem;
margin: .3rem;
+ min-width: 8rem;
text-align: center;
background-color: #f8f8f8;
border-radius: .357rem;
diff --git a/src/views/Staking.vue b/src/views/Staking.vue
index 8252652c..e175b468 100644
--- a/src/views/Staking.vue
+++ b/src/views/Staking.vue
@@ -15,7 +15,7 @@
Top 67% of Voting Power
- Validators {{ validators.length }}/{{ stakingParameters.max_validators }}
+ Validators {{ validators.length }}/{{ stakingParameters.max_validators }}
import { BRow, BCol } from 'bootstrap-vue'
import {
- formatNumber, isToken, percent, tokenFormatter,
+ formatNumber, isToken, percent, toDuration, tokenFormatter,
} from '@/libs/data'
-import dayjs from 'dayjs'
-import duration from 'dayjs/plugin/duration'
-import relativeTime from 'dayjs/plugin/relativeTime'
-import localeData from 'dayjs/plugin/localeData'
import SummaryParmetersComponent from './SummaryParmetersComponent.vue'
-dayjs.extend(duration)
-dayjs.extend(relativeTime)
-dayjs.extend(localeData)
-
export default {
components: {
BRow,
@@ -162,7 +154,7 @@ export default {
return { title: `${percent(d)}%`, subtitle: k }
}
if (d > 1000000000) {
- return { title: `${dayjs.duration(d / 1000000).humanize()}`, subtitle: k }
+ return { title: `${toDuration(d / 1000000)}`, subtitle: k }
}
return { title: data[k], subtitle: k }
})