|
3 | 3 | <label class="btn btn-option btn-option-lg" |
4 | 4 | v-for="name in ['slow', 'average', 'fast']" :key="name" |
5 | 5 | :class="{ active: (name === value)}" |
6 | | - v-tooltip="{content: getTooltip(name)}" |
| 6 | + v-tooltip="{ content: getTooltip(name)} " |
7 | 7 | v-on:click="$emit('input', name)"> |
8 | 8 | <input type="radio" name="fee" autocomplete="off" :checked="name === value"> {{name}} |
9 | 9 | </label> |
10 | 10 | </div> |
11 | 11 | </template> |
12 | 12 |
|
13 | 13 | <script> |
14 | | -import cryptoassets from '@/utils/cryptoassets' |
15 | 14 | import { getTxFee } from '@/utils/fees' |
16 | 15 | import BN from 'bignumber.js' |
| 16 | +import { prettyFiatBalance } from '@/utils/coinFormatter' |
17 | 17 |
|
18 | 18 | export default { |
19 | | - props: ['asset', 'value', 'fees', 'txTypes'], |
| 19 | + props: ['asset', 'value', 'fees', 'txTypes', 'fiatRates'], |
20 | 20 | methods: { |
21 | 21 | getTooltip (name) { |
22 | | - const unit = cryptoassets[this.asset].fees.unit |
23 | | - let content = `${this.fees[name].fee} ${unit}` |
| 22 | + let content = '<div class="text-right">' |
| 23 | + if (this.fees[name].wait) { |
| 24 | + content += `${this.fees[name].wait} sec` |
| 25 | + } |
| 26 | +
|
24 | 27 | if (this.txTypes) { |
25 | 28 | const total = this.txTypes.reduce((accum, tx) => { |
26 | 29 | return accum.plus(getTxFee(this.asset, tx, this.fees[name].fee)) |
27 | 30 | }, BN(0)) |
| 31 | + const totalFiat = prettyFiatBalance(total, this.fiatRates[this.asset]) |
28 | 32 | content += `<br />${total} ${this.asset}` |
| 33 | + content += `<br />${totalFiat} USD` |
29 | 34 | } |
30 | | - if (this.fees[name].wait) { |
31 | | - content += `<br />${this.fees[name].wait}s` |
32 | | - } |
33 | | - return content |
| 35 | +
|
| 36 | + return `${content}</div>` |
34 | 37 | } |
35 | 38 | } |
36 | 39 | } |
|
0 commit comments