2023-07-24 11:51:15 +09:00
|
|
|
import { AfterViewChecked, ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
2022-04-27 02:52:23 +04:00
|
|
|
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';
|
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,
|
|
|
|
})
|
2023-07-24 11:51:15 +09:00
|
|
|
export class LightningDashboardComponent implements OnInit, AfterViewChecked {
|
2022-04-27 02:52:23 +04:00
|
|
|
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-10-13 18:12:29 +04:00
|
|
|
this.seoService.setTitle($localize`:@@142e923d3b04186ac6ba23387265d22a2fa404e0:Lightning Explorer`);
|
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
|
|
|
}
|
|
|
|
|
2023-07-24 11:51:15 +09:00
|
|
|
ngAfterViewChecked(): void {
|
|
|
|
this.stateService.focusSearchInputDesktop();
|
|
|
|
}
|
2022-04-27 02:52:23 +04:00
|
|
|
}
|