22 * @fileOverview computed values that are used in channel UI components.
33 */
44
5- import { computed , extendObservable } from 'mobx' ;
5+ import { extendObservable } from 'mobx' ;
66import { toAmountLabel , toCaps } from '../helper' ;
77
88const ComputedChannel = store => {
99 extendObservable ( store , {
10- computedChannels : computed ( ( ) => {
10+ get computedChannels ( ) {
1111 const { channels, pendingChannels, settings } = store ;
1212 const c = channels ? channels . slice ( ) : [ ] ;
1313 const p = pendingChannels ? pendingChannels . slice ( ) : [ ] ;
@@ -23,31 +23,33 @@ const ComputedChannel = store => {
2323 c . remoteBalanceLabel = toAmountLabel ( c . remoteBalance , settings ) ;
2424 } ) ;
2525 return all ;
26- } ) ,
27- channelBalanceOpenLabel : computed ( ( ) => {
26+ } ,
27+ get channelBalanceOpenLabel ( ) {
2828 const { channels, settings } = store ;
2929 const sum = ( channels || [ ] )
3030 . map ( c => Number ( c . localBalance ) )
3131 . reduce ( ( a , b ) => a + b , 0 ) ;
3232 return toAmountLabel ( sum , settings ) ;
33- } ) ,
34- channelBalancePendingLabel : computed ( ( ) => {
33+ } ,
34+ get channelBalancePendingLabel ( ) {
3535 const { pendingChannels, settings } = store ;
3636 const sum = ( pendingChannels || [ ] )
3737 . filter ( c => c . status . includes ( 'open' ) )
3838 . map ( c => Number ( c . localBalance ) )
3939 . reduce ( ( a , b ) => a + b , 0 ) ;
4040 return toAmountLabel ( sum , settings ) ;
41- } ) ,
42- channelBalanceClosingLabel : computed ( ( ) => {
41+ } ,
42+ get channelBalanceClosingLabel ( ) {
4343 const { pendingChannels, settings } = store ;
4444 const sum = ( pendingChannels || [ ] )
4545 . filter ( c => ! c . status . includes ( 'open' ) )
4646 . map ( c => Number ( c . localBalance ) )
4747 . reduce ( ( a , b ) => a + b , 0 ) ;
4848 return toAmountLabel ( sum , settings ) ;
49- } ) ,
50- showChannelAlert : computed ( ( ) => ( store . channels || [ ] ) . length === 0 ) ,
49+ } ,
50+ get showChannelAlert ( ) {
51+ return ( store . channels || [ ] ) . length === 0 ;
52+ } ,
5153 } ) ;
5254} ;
5355
0 commit comments