mempool/frontend/src/app/bisq/bisq-stats/bisq-stats.component.ts

42 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-07-14 14:38:52 +07:00
import { Component, OnInit } from '@angular/core';
import { BisqApiService } from '../bisq-api.service';
import { BisqStats } from '../bisq.interfaces';
import { SeoService } from 'src/app/services/seo.service';
2020-07-14 21:26:02 +07:00
import { StateService } from 'src/app/services/state.service';
import { WebsocketService } from 'src/app/services/websocket.service';
2020-07-14 14:38:52 +07:00
@Component({
selector: 'app-bisq-stats',
templateUrl: './bisq-stats.component.html',
styleUrls: ['./bisq-stats.component.scss']
})
export class BisqStatsComponent implements OnInit {
isLoading = true;
stats: BisqStats;
2020-07-14 21:26:02 +07:00
price: number;
2020-07-14 14:38:52 +07:00
constructor(
private websocketService: WebsocketService,
2020-07-14 14:38:52 +07:00
private bisqApiService: BisqApiService,
private seoService: SeoService,
2020-07-14 21:26:02 +07:00
private stateService: StateService,
2020-07-14 14:38:52 +07:00
) { }
2020-07-14 21:26:02 +07:00
ngOnInit() {
this.websocketService.want(['blocks']);
2020-12-03 18:34:19 +07:00
this.seoService.setTitle($localize`:@@2a30a4cdb123a03facc5ab8c5b3e6d8b8dbbc3d4:BSQ statistics`);
2020-07-14 21:26:02 +07:00
this.stateService.bsqPrice$
.subscribe((bsqPrice) => {
this.price = bsqPrice;
});
2020-07-14 14:38:52 +07:00
this.bisqApiService.getStats$()
.subscribe((stats) => {
this.isLoading = false;
this.stats = stats;
});
}
}