2022-04-27 02:52:23 +04:00
|
|
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs';
|
2022-08-17 12:53:26 +02:00
|
|
|
import { share } from 'rxjs/operators';
|
|
|
|
import { INodesRanking } from 'src/app/interfaces/node-api.interface';
|
2022-07-10 14:07:53 +02:00
|
|
|
import { SeoService } from 'src/app/services/seo.service';
|
2022-09-17 01:26:32 +02:00
|
|
|
import { StateService } from 'src/app/services/state.service';
|
2022-04-27 02:52:23 +04:00
|
|
|
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;
|
2022-04-27 02:52:23 +04:00
|
|
|
|
|
|
|
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,
|
2022-04-27 02:52:23 +04:00
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
2022-09-07 15:38:48 +02:00
|
|
|
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());
|
2022-07-06 14:56:10 +02:00
|
|
|
this.statistics$ = this.lightningApiService.getLatestStatistics$().pipe(share());
|
2022-04-27 02:52:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|