Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 921515f

Browse files
committed
Port ComputedSetting to mobx 4
1 parent 497ffa0 commit 921515f

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

src/computed/setting.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,36 @@
22
* @fileOverview computed values that are used in settings UI components.
33
*/
44

5-
import { computed, extendObservable } from 'mobx';
5+
import { extendObservable } from 'mobx';
66
import { formatNumber } from '../helper';
77
import { UNITS, FIATS } from '../config';
88

99
const ComputedSetting = store => {
1010
extendObservable(store, {
11-
selectedUnitLabel: computed(() => getUnitLabel(store.settings.unit)),
12-
selectedFiatLabel: computed(() => FIATS[store.settings.fiat].displayLong),
13-
satUnitLabel: computed(() => getUnitLabel('sat')),
14-
bitUnitLabel: computed(() => getUnitLabel('bit')),
15-
btcUnitLabel: computed(() => getUnitLabel('btc')),
16-
usdFiatLabel: computed(() => FIATS['usd'].displayLong),
17-
eurFiatLabel: computed(() => FIATS['eur'].displayLong),
18-
gbpFiatLabel: computed(() => FIATS['gbp'].displayLong),
11+
get selectedUnitLabel() {
12+
return getUnitLabel(store.settings.unit);
13+
},
14+
get selectedFiatLabel() {
15+
return FIATS[store.settings.fiat].displayLong;
16+
},
17+
get satUnitLabel() {
18+
return getUnitLabel('sat');
19+
},
20+
get bitUnitLabel() {
21+
return getUnitLabel('bit');
22+
},
23+
get btcUnitLabel() {
24+
return getUnitLabel('btc');
25+
},
26+
get usdFiatLabel() {
27+
return FIATS['usd'].displayLong;
28+
},
29+
get eurFiatLabel() {
30+
return FIATS['eur'].displayLong;
31+
},
32+
get gbpFiatLabel() {
33+
return FIATS['gbp'].displayLong;
34+
},
1935
});
2036
};
2137

0 commit comments

Comments
 (0)