classic-ui/components/BalanceModalBox.vue
Danil Kovtonyuk 44f31f8b9f
init
2022-04-22 13:14:19 +10:00

42 lines
1.3 KiB
Vue

<template>
<div class="modal-card box box-modal">
<header class="box-modal-header is-spaced">
<div class="box-modal-title">{{ $t('insufficientBalance') }}</div>
<button type="button" class="delete" @click="$emit('close')" />
</header>
<i18n path="youDontHaveEnoughTokens" tag="div" class="note">
<template v-slot:currency>{{ selectedCurrency }}</template>
<template v-slot:balance><number-format :value="currentBalance"/></template>
</i18n>
<b-button type="is-primary is-fullwidth" @click="close">{{ $t('close') }}</b-button>
</div>
</template>
<script>
/* eslint-disable no-console */
import { mapState, mapGetters } from 'vuex'
import NumberFormat from '@/components/NumberFormat'
export default {
components: {
NumberFormat
},
computed: {
...mapState('application', ['selectedInstance']),
...mapState('token', ['balance']),
...mapGetters('token', ['toDecimals']),
...mapState('metamask', ['ethBalance']),
...mapGetters('metamask', ['nativeCurrency']),
...mapGetters('application', ['selectedCurrency']),
currentBalance() {
const balance = this.selectedInstance.currency === this.nativeCurrency ? this.ethBalance : this.balance
return this.toDecimals(balance, null, 6)
}
},
methods: {
close() {
this.$parent.close()
}
}
}
</script>