2024-04-10 06:27:48 +00:00
|
|
|
import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit } from '@angular/core';
|
2024-02-27 15:20:15 +01:00
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { ServicesApiServices } from '../../../services/services-api.service';
|
|
|
|
|
|
|
|
export type AccelerationStats = {
|
|
|
|
totalRequested: number;
|
|
|
|
totalBidBoost: number;
|
|
|
|
successRate: number;
|
|
|
|
}
|
2023-12-07 08:26:32 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-acceleration-stats',
|
|
|
|
templateUrl: './acceleration-stats.component.html',
|
|
|
|
styleUrls: ['./acceleration-stats.component.scss'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
|
})
|
2024-04-10 06:27:48 +00:00
|
|
|
export class AccelerationStatsComponent implements OnInit, OnChanges {
|
|
|
|
@Input() timespan: '3d' | '1w' | '1m' = '1w';
|
2024-02-27 15:20:15 +01:00
|
|
|
accelerationStats$: Observable<AccelerationStats>;
|
2023-12-07 08:26:32 +00:00
|
|
|
|
|
|
|
constructor(
|
2024-02-27 15:20:15 +01:00
|
|
|
private servicesApiService: ServicesApiServices
|
2023-12-07 08:26:32 +00:00
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
2024-04-10 06:27:48 +00:00
|
|
|
this.accelerationStats$ = this.servicesApiService.getAccelerationStats$({ timeframe: this.timespan });
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnChanges(): void {
|
|
|
|
this.accelerationStats$ = this.servicesApiService.getAccelerationStats$({ timeframe: this.timespan });
|
2023-12-07 08:26:32 +00:00
|
|
|
}
|
|
|
|
}
|