|
2 | 2 | * @fileOverview computed values that are used in wallet UI components. |
3 | 3 | */ |
4 | 4 |
|
5 | | -import { computed, extendObservable } from 'mobx'; |
| 5 | +import { extendObservable } from 'mobx'; |
6 | 6 | import { toAmountLabel } from '../helper'; |
7 | 7 | import { UNITS, FIATS } from '../config'; |
8 | 8 |
|
9 | 9 | const ComputedWallet = store => { |
10 | 10 | extendObservable(store, { |
11 | | - walletAddressUri: computed( |
12 | | - () => (store.walletAddress ? `bitcoin:${store.walletAddress}` : '') |
13 | | - ), |
14 | | - depositLabel: computed(() => { |
| 11 | + get walletAddressUri() { |
| 12 | + return store.walletAddress ? `bitcoin:${store.walletAddress}` : ''; |
| 13 | + }, |
| 14 | + get depositLabel() { |
15 | 15 | const { balanceSatoshis, pendingBalanceSatoshis, settings } = store; |
16 | 16 | return toAmountLabel(balanceSatoshis + pendingBalanceSatoshis, settings); |
17 | | - }), |
18 | | - channelBalanceLabel: computed(() => |
19 | | - toAmountLabel(store.channelBalanceSatoshis, store.settings) |
20 | | - ), |
21 | | - unitFiatLabel: computed(() => { |
| 17 | + }, |
| 18 | + get channelBalanceLabel() { |
| 19 | + return toAmountLabel(store.channelBalanceSatoshis, store.settings); |
| 20 | + }, |
| 21 | + get unitFiatLabel() { |
22 | 22 | const { displayFiat, unit, fiat } = store.settings; |
23 | 23 | return displayFiat ? FIATS[fiat].display : UNITS[unit].display; |
24 | | - }), |
25 | | - unitLabel: computed(() => { |
| 24 | + }, |
| 25 | + get unitLabel() { |
26 | 26 | const { settings } = store; |
27 | 27 | return !settings.displayFiat ? UNITS[settings.unit].display : null; |
28 | | - }), |
| 28 | + }, |
29 | 29 | }); |
30 | 30 | }; |
31 | 31 |
|
|
0 commit comments