mempool/frontend/src/app/lightning/lightning-dashboard/lightning-dashboard.component.ts

34 lines
1.2 KiB
TypeScript
Raw Normal View History

import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
2022-08-17 12:53:26 +02:00
import { share } from 'rxjs/operators';
2022-09-21 17:23:45 +02:00
import { INodesRanking } from '../../interfaces/node-api.interface';
import { SeoService } from '../../services/seo.service';
import { StateService } from '../../services/state.service';
import { LightningApiService } from '../lightning-api.service';
@Component({
selector: 'app-lightning-dashboard',
templateUrl: './lightning-dashboard.component.html',
styleUrls: ['./lightning-dashboard.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LightningDashboardComponent implements OnInit {
statistics$: Observable<any>;
2022-08-17 12:53:26 +02:00
nodesRanking$: Observable<INodesRanking>;
2022-09-17 01:26:32 +02:00
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
constructor(
private lightningApiService: LightningApiService,
2022-07-10 14:07:53 +02:00
private seoService: SeoService,
2022-09-17 01:26:32 +02:00
private stateService: StateService,
) { }
ngOnInit(): void {
this.seoService.setTitle($localize`Lightning Network`);
2022-07-10 14:07:53 +02:00
2022-08-17 12:53:26 +02:00
this.nodesRanking$ = this.lightningApiService.getNodesRanking$().pipe(share());
this.statistics$ = this.lightningApiService.getLatestStatistics$().pipe(share());
}
}