2020-02-17 20:39:20 +07:00
|
|
|
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
|
2019-07-24 23:08:28 +03:00
|
|
|
import { Subscription } from 'rxjs';
|
|
|
|
import { take } from 'rxjs/operators';
|
2020-02-16 22:15:07 +07:00
|
|
|
import { StateService } from 'src/app/services/state.service';
|
2019-07-21 17:59:47 +03:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-blockchain',
|
|
|
|
templateUrl: './blockchain.component.html',
|
|
|
|
styleUrls: ['./blockchain.component.scss']
|
|
|
|
})
|
|
|
|
export class BlockchainComponent implements OnInit, OnDestroy {
|
2020-02-17 20:39:20 +07:00
|
|
|
@Input() position: 'middle' | 'top' = 'middle';
|
2020-02-19 23:50:23 +07:00
|
|
|
@Input() markHeight: number;
|
2020-02-23 05:23:24 +07:00
|
|
|
@Input() txFeePerVSize: number;
|
2020-03-17 21:53:20 +07:00
|
|
|
@Input() markMempoolBlockIndex = -1;
|
2020-02-17 20:39:20 +07:00
|
|
|
|
2019-07-24 23:08:28 +03:00
|
|
|
txTrackingSubscription: Subscription;
|
|
|
|
blocksSubscription: Subscription;
|
2019-07-21 17:59:47 +03:00
|
|
|
|
|
|
|
txTrackingLoading = false;
|
|
|
|
txShowTxNotFound = false;
|
2019-07-24 23:08:28 +03:00
|
|
|
isLoading = true;
|
2019-07-21 17:59:47 +03:00
|
|
|
|
|
|
|
constructor(
|
2020-02-16 22:15:07 +07:00
|
|
|
private stateService: StateService,
|
2019-07-21 17:59:47 +03:00
|
|
|
) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-02-16 22:15:07 +07:00
|
|
|
this.blocksSubscription = this.stateService.blocks$
|
2019-07-24 23:08:28 +03:00
|
|
|
.pipe(
|
|
|
|
take(1)
|
|
|
|
)
|
|
|
|
.subscribe((block) => this.isLoading = false);
|
2019-07-21 17:59:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
2019-07-24 23:08:28 +03:00
|
|
|
this.blocksSubscription.unsubscribe();
|
2019-07-21 17:59:47 +03:00
|
|
|
}
|
|
|
|
}
|