optimize UI

This commit is contained in:
liangping 2021-10-12 20:25:53 +08:00
parent 4b1da2b63d
commit 8c7e2f6620
3 changed files with 19 additions and 37 deletions

View File

@ -6,9 +6,9 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1" /> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1" />
<!-- Splash Screen/Loader Styles --> <!-- Splash Screen/Loader Styles -->
<link rel="stylesheet" type="text/css" href="<%= BASE_URL %>loader.css" /> <link rel="stylesheet" type="text/css" href="loader.css" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" /> <link rel="icon" href="favicon.ico" />
<link <link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap" href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap"
rel="stylesheet" rel="stylesheet"
@ -24,7 +24,7 @@
</noscript> </noscript>
<div id="loading-bg"> <div id="loading-bg">
<div class="loading-logo"> <div class="loading-logo">
<img src="<%= BASE_URL %>logo.svg" alt="Logo" width="80"/> <img src="logo.svg" alt="Logo" width="80"/>
</div> </div>
<div class="loading"> <div class="loading">
<div class="effect-1 effects"></div> <div class="effect-1 effects"></div>

View File

@ -269,16 +269,14 @@ export function formatTokenDenom(tokenDenom) {
} }
export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') { export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
let decimals = 1000000n let amount
if (denom.startsWith('rowan')) { if (denom.startsWith('rowan')) {
decimals = 1000000000000000000n // eslint-disable-next-line no-undef
amount = Number(BigInt(Number(tokenAmount)) / 1000000000000000000n)
// }
} else {
amount = Number(tokenAmount) / 1000000
} }
let ta = tokenAmount
if (typeof tokenAmount === 'string' && tokenAmount.indexOf('.') > 0) {
ta = tokenAmount.substring(0, tokenAmount.indexOf('.'))
}
// eslint-disable-next-line no-undef
const amount = Number(BigInt(ta) / decimals)
if (amount > 10) { if (amount > 10) {
return parseFloat(amount.toFixed(fraction)) return parseFloat(amount.toFixed(fraction))
} }
@ -287,7 +285,7 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
export function formatToken(token, IBCDenom = {}) { export function formatToken(token, IBCDenom = {}) {
if (token) { if (token) {
return `${formatTokenAmount(token.amount, 2, token.denom)} ${formatTokenDenom(IBCDenom[token.denom] || token.denom)}` return `${formatTokenAmount(token.amount, 0, token.denom)} ${formatTokenDenom(IBCDenom[token.denom] || token.denom)}`
} }
return token return token
} }

View File

@ -170,18 +170,10 @@
:key="i" :key="i"
class="d-flex justify-content-between align-items-center" class="d-flex justify-content-between align-items-center"
> >
<div class="ml-25 font-weight-bolder text-uppercase text-success"> <div
<b-avatar class="ml-25 font-weight-bolder text-uppercase text-success"
variant="light-success" title="Balance"
rounded >
title="Balance"
>
<feather-icon
icon="CreditCardIcon"
size="16"
class="d-none d-md-block"
/>
</b-avatar>
{{ formatDenom(b.denom) }} {{ formatDenom(b.denom) }}
<small <small
:class="priceColor(b.denom)" :class="priceColor(b.denom)"
@ -198,18 +190,10 @@
:key="`d-${i}`" :key="`d-${i}`"
class="d-flex justify-content-between align-items-center" class="d-flex justify-content-between align-items-center"
> >
<div class="ml-25 font-weight-bolder text-uppercase text-primary"> <div
<b-avatar class="ml-25 font-weight-bolder text-uppercase text-primary"
variant="light-primary" title="Delegations"
rounded >
title="Delegations"
>
<feather-icon
icon="LockIcon"
size="16"
class="d-none d-md-block"
/>
</b-avatar>
{{ formatDenom(b.denom) }} {{ formatDenom(b.denom) }}
<small <small
:class="priceColor(b.denom)" :class="priceColor(b.denom)"
@ -556,7 +540,7 @@ export default {
}, },
formatChanges(denom) { formatChanges(denom) {
const price = this.getChanges(denom) const price = this.getChanges(denom)
return `${parseFloat(price.toFixed(2))}%` return price === 0 ? '' : `${parseFloat(price.toFixed(2))}%`
}, },
formatBalance(v) { formatBalance(v) {
let total = 0 let total = 0