2019-12-03 20:44:07 +00:00
|
|
|
import { Component, OnChanges, Input } from '@angular/core';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'rtl-balances-info',
|
|
|
|
templateUrl: './balances-info.component.html',
|
|
|
|
styleUrls: ['./balances-info.component.scss']
|
|
|
|
})
|
|
|
|
export class BalancesInfoComponent implements OnChanges {
|
|
|
|
@Input() balances = { onchain: 0, lightning: 0 };
|
2019-12-04 23:14:34 +00:00
|
|
|
@Input() flgInfoUpdate = false;
|
2019-12-20 23:24:31 +00:00
|
|
|
@Input() cardHeight = '';
|
2019-12-04 02:14:39 +00:00
|
|
|
flgBalanceUpdated = false;
|
2019-12-05 20:16:41 +00:00
|
|
|
totalBalances = [{'name': 'Lightning', 'value': 0}, {'name': 'On-chain', 'value': 0}];
|
2019-12-04 23:14:34 +00:00
|
|
|
maxBalanceValue = 0;
|
2019-12-04 02:14:39 +00:00
|
|
|
xAxisLabel = 'Balance';
|
2019-12-20 23:24:31 +00:00
|
|
|
graphView = [200, 120];
|
2019-12-03 20:44:07 +00:00
|
|
|
|
|
|
|
constructor() {}
|
|
|
|
|
2019-12-04 02:14:39 +00:00
|
|
|
ngOnChanges() {
|
2019-12-20 23:24:31 +00:00
|
|
|
this.graphView = [200, Math.floor(+this.cardHeight.substring(0, this.cardHeight.length-2))*2];
|
2019-12-05 20:16:41 +00:00
|
|
|
this.totalBalances = [{'name': 'Lightning', 'value': this.balances.lightning}, {'name': 'On-chain', 'value': this.balances.onchain}];
|
2019-12-04 23:14:34 +00:00
|
|
|
this.maxBalanceValue = (this.balances.lightning > this.balances.onchain) ? this.balances.lightning : this.balances.onchain;
|
|
|
|
Object.assign(this, this.totalBalances);
|
2019-12-04 02:14:39 +00:00
|
|
|
}
|
2019-12-03 20:44:07 +00:00
|
|
|
|
|
|
|
}
|