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" />
<!-- 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
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap"
rel="stylesheet"
@ -24,7 +24,7 @@
</noscript>
<div id="loading-bg">
<div class="loading-logo">
<img src="<%= BASE_URL %>logo.svg" alt="Logo" width="80"/>
<img src="logo.svg" alt="Logo" width="80"/>
</div>
<div class="loading">
<div class="effect-1 effects"></div>

View File

@ -269,16 +269,14 @@ export function formatTokenDenom(tokenDenom) {
}
export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
let decimals = 1000000n
let amount
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) {
return parseFloat(amount.toFixed(fraction))
}
@ -287,7 +285,7 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
export function formatToken(token, IBCDenom = {}) {
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
}

View File

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