2020-03-29 23:59:04 +07:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2020-02-16 22:15:07 +07:00
|
|
|
import { WebsocketService } from 'src/app/services/websocket.service';
|
2020-02-17 00:26:57 +07:00
|
|
|
import { OptimizedMempoolStats } from '../../interfaces/node-api.interface';
|
2020-02-16 22:15:07 +07:00
|
|
|
import { StateService } from 'src/app/services/state.service';
|
|
|
|
import { ApiService } from 'src/app/services/api.service';
|
2020-03-24 00:52:08 +07:00
|
|
|
import { SeoService } from 'src/app/services/seo.service';
|
2022-02-02 17:49:38 +09:00
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { switchMap } from 'rxjs/operators';
|
2019-07-27 18:43:17 +03:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-television',
|
|
|
|
templateUrl: './television.component.html',
|
|
|
|
styleUrls: ['./television.component.scss']
|
|
|
|
})
|
|
|
|
export class TelevisionComponent implements OnInit {
|
|
|
|
|
2020-02-17 00:26:57 +07:00
|
|
|
mempoolStats: OptimizedMempoolStats[] = [];
|
2019-07-27 18:43:17 +03:00
|
|
|
mempoolVsizeFeesData: any;
|
|
|
|
|
|
|
|
constructor(
|
2020-02-16 22:15:07 +07:00
|
|
|
private websocketService: WebsocketService,
|
|
|
|
private apiService: ApiService,
|
|
|
|
private stateService: StateService,
|
2020-03-24 00:52:08 +07:00
|
|
|
private seoService: SeoService,
|
2022-02-02 17:49:38 +09:00
|
|
|
private route: ActivatedRoute
|
2019-07-27 18:43:17 +03:00
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-12-03 18:34:19 +07:00
|
|
|
this.seoService.setTitle($localize`:@@46ce8155c9ab953edeec97e8950b5a21e67d7c4e:TV view`);
|
2020-03-14 13:48:01 +07:00
|
|
|
this.websocketService.want(['blocks', 'live-2h-chart', 'mempool-blocks']);
|
2019-08-15 14:50:05 +03:00
|
|
|
|
2022-02-02 17:49:38 +09:00
|
|
|
this.route.fragment
|
|
|
|
.pipe(
|
2022-02-05 19:06:27 +09:00
|
|
|
switchMap((fragment) => {
|
|
|
|
switch (fragment) {
|
2022-02-02 17:49:38 +09:00
|
|
|
case '2h': return this.apiService.list2HStatistics$();
|
|
|
|
case '24h': return this.apiService.list24HStatistics$();
|
|
|
|
case '1w': return this.apiService.list1WStatistics$();
|
|
|
|
case '1m': return this.apiService.list1MStatistics$();
|
|
|
|
case '3m': return this.apiService.list3MStatistics$();
|
|
|
|
case '6m': return this.apiService.list6MStatistics$();
|
|
|
|
case '1y': return this.apiService.list1YStatistics$();
|
|
|
|
case '2y': return this.apiService.list2YStatistics$();
|
|
|
|
case '3y': return this.apiService.list3YStatistics$();
|
|
|
|
default: return this.apiService.list2HStatistics$();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|
2019-07-27 18:43:17 +03:00
|
|
|
.subscribe((mempoolStats) => {
|
|
|
|
this.mempoolStats = mempoolStats;
|
|
|
|
});
|
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
this.stateService.live2Chart$
|
2019-07-27 18:43:17 +03:00
|
|
|
.subscribe((mempoolStats) => {
|
|
|
|
this.mempoolStats.unshift(mempoolStats);
|
|
|
|
this.mempoolStats = this.mempoolStats.slice(0, this.mempoolStats.length - 1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|