Merge branch 'master' into nymkappa/feature/address-list-collapse

This commit is contained in:
softsimon
2022-03-29 13:08:11 +04:00
committed by GitHub
32 changed files with 573 additions and 820 deletions

View File

@@ -29,14 +29,12 @@ export class PoolComponent implements OnInit {
chartOptions: EChartsOption = {};
chartInitOptions = {
renderer: 'svg',
width: 'auto',
height: 'auto',
};
blocks: BlockExtended[] = [];
poolId: number = undefined;
slug: string = undefined;
loadMoreSubject: BehaviorSubject<number> = new BehaviorSubject(this.poolId);
loadMoreSubject: BehaviorSubject<string> = new BehaviorSubject(this.slug);
constructor(
@Inject(LOCALE_ID) public locale: string,
@@ -47,23 +45,23 @@ export class PoolComponent implements OnInit {
}
ngOnInit(): void {
this.poolStats$ = this.route.params.pipe(map((params) => params.poolId))
this.poolStats$ = this.route.params.pipe(map((params) => params.slug))
.pipe(
switchMap((poolId: any) => {
switchMap((slug: any) => {
this.isLoading = true;
this.poolId = poolId;
this.loadMoreSubject.next(this.poolId);
return this.apiService.getPoolHashrate$(this.poolId)
this.slug = slug;
this.loadMoreSubject.next(this.slug);
return this.apiService.getPoolHashrate$(this.slug)
.pipe(
switchMap((data) => {
this.isLoading = false;
this.prepareChartOptions(data.hashrates.map(val => [val.timestamp * 1000, val.avgHashrate]));
return poolId;
return slug;
}),
);
}),
switchMap(() => {
return this.apiService.getPoolStats$(this.poolId);
return this.apiService.getPoolStats$(this.slug);
}),
map((poolStats) => {
let regexes = '"';
@@ -82,10 +80,10 @@ export class PoolComponent implements OnInit {
this.blocks$ = this.loadMoreSubject
.pipe(
switchMap((flag) => {
if (this.poolId === undefined) {
if (this.slug === undefined) {
return [];
}
return this.apiService.getPoolBlocks$(this.poolId, this.blocks[this.blocks.length - 1]?.height);
return this.apiService.getPoolBlocks$(this.slug, this.blocks[this.blocks.length - 1]?.height);
}),
tap((newBlocks) => {
this.blocks = this.blocks.concat(newBlocks);
@@ -184,7 +182,7 @@ export class PoolComponent implements OnInit {
}
loadMore() {
this.loadMoreSubject.next(this.poolId);
this.loadMoreSubject.next(this.slug);
}
trackByBlock(index: number, block: BlockExtended) {