mempool/frontend/src/app/components/blockchain/blockchain.component.ts

42 lines
1.1 KiB
TypeScript
Raw Normal View History

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';
import { StateService } from 'src/app/services/state.service';
import { Router } from '@angular/router';
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';
@Input() markHeight: number;
@Input() txFeePerVSize: number;
@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(
private stateService: StateService,
private router: Router,
2019-07-21 17:59:47 +03:00
) {}
ngOnInit() {
this.blocksSubscription = this.stateService.blocks$
2019-07-24 23:08:28 +03:00
.pipe(
take(1)
)
.subscribe(() => 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
}
}