imp: adjust the layout.
This commit is contained in:
parent
910f65c6d7
commit
8f9e490124
@ -11,7 +11,6 @@ const props = defineProps({
|
|||||||
:time="time > 0 ? time : 0"
|
:time="time > 0 ? time : 0"
|
||||||
v-slot="{ days, hours, minutes, seconds }"
|
v-slot="{ days, hours, minutes, seconds }"
|
||||||
>
|
>
|
||||||
Time Remaining:{{ days }} days, {{ hours }} hours, {{ minutes }} minutes,
|
{{ days }} days {{ hours }} hours {{ minutes }} minutes {{ seconds }} seconds
|
||||||
{{ seconds }} seconds.
|
|
||||||
</Countdown>
|
</Countdown>
|
||||||
</template>
|
</template>
|
||||||
|
@ -19,6 +19,7 @@ import type {
|
|||||||
UnbondingResponses,
|
UnbondingResponses,
|
||||||
} from '@/types';
|
} from '@/types';
|
||||||
import type { Coin } from '@cosmjs/amino';
|
import type { Coin } from '@cosmjs/amino';
|
||||||
|
import Countdown from '@/components/Countdown.vue';
|
||||||
|
|
||||||
const props = defineProps(['address', 'chain']);
|
const props = defineProps(['address', 'chain']);
|
||||||
|
|
||||||
@ -65,6 +66,11 @@ const totalAmount = computed(() => {
|
|||||||
return totalAmountByCategory.value.reduce((p, c) => c + p, 0);
|
return totalAmountByCategory.value.reduce((p, c) => c + p, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const totalValue = computed(() => {
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function loadAccount(address: string) {
|
function loadAccount(address: string) {
|
||||||
blockchain.rpc.getAuthAccount(address).then((x) => {
|
blockchain.rpc.getAuthAccount(address).then((x) => {
|
||||||
account.value = x.account;
|
account.value = x.account;
|
||||||
@ -125,12 +131,8 @@ function updateEvent() {
|
|||||||
|
|
||||||
<!-- Assets -->
|
<!-- Assets -->
|
||||||
<div class="bg-base-100 px-4 pt-3 pb-4 rounded mb-4 shadow">
|
<div class="bg-base-100 px-4 pt-3 pb-4 rounded mb-4 shadow">
|
||||||
|
<div class="flex justify-between">
|
||||||
<h2 class="card-title mb-4">Assets</h2>
|
<h2 class="card-title mb-4">Assets</h2>
|
||||||
<div class="grid md:!grid-cols-3">
|
|
||||||
<div class="md:!col-span-1">
|
|
||||||
<DonutChart :series="totalAmountByCategory" :labels="labels" />
|
|
||||||
</div>
|
|
||||||
<div class="mt-4 md:!col-span-2 md:!mt-0 md:!ml-4">
|
|
||||||
<!-- button -->
|
<!-- button -->
|
||||||
<div class="flex justify-end mb-4 pr-5">
|
<div class="flex justify-end mb-4 pr-5">
|
||||||
<label
|
<label
|
||||||
@ -154,6 +156,12 @@ function updateEvent() {
|
|||||||
>transfer</label
|
>transfer</label
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid md:!grid-cols-3">
|
||||||
|
<div class="md:!col-span-1">
|
||||||
|
<DonutChart :series="totalAmountByCategory" :labels="labels" />
|
||||||
|
</div>
|
||||||
|
<div class="mt-4 md:!col-span-2 md:!mt-0 md:!ml-4">
|
||||||
<!-- list-->
|
<!-- list-->
|
||||||
<div class="">
|
<div class="">
|
||||||
<!--balances -->
|
<!--balances -->
|
||||||
@ -299,7 +307,7 @@ function updateEvent() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4 text-lg font-semibold mr-5 pl-5 border-t pt-4">
|
<div class="mt-4 text-lg font-semibold mr-5 pl-5 border-t pt-4">
|
||||||
{{ totalAmount }}
|
Total Value: ${{ totalValue }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -307,6 +315,7 @@ function updateEvent() {
|
|||||||
|
|
||||||
<!-- Delegations -->
|
<!-- Delegations -->
|
||||||
<div class="bg-base-100 px-4 pt-3 pb-4 rounded mb-4 shadow">
|
<div class="bg-base-100 px-4 pt-3 pb-4 rounded mb-4 shadow">
|
||||||
|
<div class="flex justify-between">
|
||||||
<h2 class="card-title mb-4">Delegations</h2>
|
<h2 class="card-title mb-4">Delegations</h2>
|
||||||
<div class="flex justify-end mb-4">
|
<div class="flex justify-end mb-4">
|
||||||
<label
|
<label
|
||||||
@ -322,6 +331,7 @@ function updateEvent() {
|
|||||||
>Withdraw</label
|
>Withdraw</label
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="overflow-x-auto">
|
<div class="overflow-x-auto">
|
||||||
<table class="table w-full text-sm table-zebra">
|
<table class="table w-full text-sm table-zebra">
|
||||||
<thead>
|
<thead>
|
||||||
@ -338,12 +348,12 @@ function updateEvent() {
|
|||||||
<RouterLink
|
<RouterLink
|
||||||
:to="`/${chain}/staking/${v.delegation.validator_address}`"
|
:to="`/${chain}/staking/${v.delegation.validator_address}`"
|
||||||
>{{
|
>{{
|
||||||
format.validatorFromBech32(v.delegation.validator_address)
|
format.validatorFromBech32(v.delegation.validator_address) || v.delegation.validator_address
|
||||||
}}</RouterLink
|
}}</RouterLink
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3">
|
<td class="py-3">
|
||||||
{{ format.formatToken(v.balance, true, '0,0.[00]') }}
|
{{ format.formatToken(v.balance, true, '0,0.[000000]') }}
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3">
|
<td class="py-3">
|
||||||
{{
|
{{
|
||||||
@ -356,7 +366,7 @@ function updateEvent() {
|
|||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3">
|
<td class="py-3">
|
||||||
<div class="flex justify-end">
|
<div v-if="v.balance" class="flex justify-end">
|
||||||
<label
|
<label
|
||||||
for="delegate"
|
for="delegate"
|
||||||
class="btn btn-primary btn-xs mr-2"
|
class="btn btn-primary btn-xs mr-2"
|
||||||
@ -423,14 +433,13 @@ function updateEvent() {
|
|||||||
<th class="py-3">Completion Time</th>
|
<th class="py-3">Completion Time</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-sm">
|
<tbody class="text-sm" v-for="(v, index) in unbonding" :key="index">
|
||||||
<div v-for="(v, index) in unbonding" :key="index">
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-caption text-primary py-3">
|
<td class="text-caption text-primary py-3 bg-slate-200" colspan="10">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="`/${chain}/staking/${v.validator_address}`"
|
:to="`/${chain}/staking/${v.validator_address}`"
|
||||||
>{{
|
>{{
|
||||||
format.validatorFromBech32(v.validator_address)
|
v.validator_address
|
||||||
}}</RouterLink
|
}}</RouterLink
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
@ -462,10 +471,9 @@ function updateEvent() {
|
|||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3">
|
<td class="py-3">
|
||||||
{{ format.toDay(entry.completion_time, 'to') }}
|
<Countdown :time="new Date(entry.completion_time).getTime() - new Date().getTime()" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</div>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -280,7 +280,7 @@ export const useDashboard = defineStore('dashboard', {
|
|||||||
const coinIds = [] as string[]
|
const coinIds = [] as string[]
|
||||||
Object.keys(this.favoriteMap).forEach(k => {
|
Object.keys(this.favoriteMap).forEach(k => {
|
||||||
if(this.chains[k]) this.chains[k].assets.forEach(a => {
|
if(this.chains[k]) this.chains[k].assets.forEach(a => {
|
||||||
if(a.coingecko_id !== undefined) {
|
if(a.coingecko_id !== undefined && a.coingecko_id.length > 0) {
|
||||||
coinIds.push(a.coingecko_id)
|
coinIds.push(a.coingecko_id)
|
||||||
a.denom_units.forEach(u => {
|
a.denom_units.forEach(u => {
|
||||||
this.coingecko[u.denom] = {
|
this.coingecko[u.denom] = {
|
||||||
|
@ -85,6 +85,7 @@ export const useFormatter = defineStore('formatter', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
price(denom: string, currency = "usd") {
|
price(denom: string, currency = "usd") {
|
||||||
|
if(!denom || denom.length < 2) return 0
|
||||||
const info = this.priceInfo(denom);
|
const info = this.priceInfo(denom);
|
||||||
return info ? info[currency] || 0 : 0;
|
return info ? info[currency] || 0 : 0;
|
||||||
},
|
},
|
||||||
@ -101,13 +102,21 @@ export const useFormatter = defineStore('formatter', {
|
|||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
|
specialDenom(denom: string) {
|
||||||
|
switch(true) {
|
||||||
|
case denom.startsWith('u'): return 6
|
||||||
|
case denom.startsWith("a"): return 18
|
||||||
|
case denom==='inj': return 18
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
},
|
||||||
tokenValueNumber(token?: Coin) {
|
tokenValueNumber(token?: Coin) {
|
||||||
if(!token) return 0
|
if(!token || !token.denom) return 0
|
||||||
// find the symbol,
|
// find the symbol,
|
||||||
const symbol = this.dashboard.coingecko[token.denom]?.symbol || ""
|
const symbol = this.dashboard.coingecko[token.denom]?.symbol || token.denom
|
||||||
// convert denomation to to symbol
|
// convert denomation to to symbol
|
||||||
const exponent =
|
const exponent =
|
||||||
this.dashboard.coingecko[symbol.toLowerCase()]?.exponent || 0;
|
this.dashboard.coingecko[symbol?.toLowerCase()]?.exponent || this.specialDenom(token.denom);
|
||||||
// cacualte amount of symbol
|
// cacualte amount of symbol
|
||||||
const amount = Number(token.amount) / (10 ** exponent)
|
const amount = Number(token.amount) / (10 ** exponent)
|
||||||
const value = amount * this.price(token.denom)
|
const value = amount * this.price(token.denom)
|
||||||
|
Loading…
Reference in New Issue
Block a user