Add 24h and all time views to accelerator dashboard

This commit is contained in:
Mononaut
2024-07-11 16:48:41 +00:00
parent 5bb3e930cc
commit 75ca963bd5
4 changed files with 23 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ export type AccelerationStats = {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AccelerationStatsComponent implements OnInit, OnChanges {
@Input() timespan: '3d' | '1w' | '1m' = '1w';
@Input() timespan: '24h' | '3d' | '1w' | '1m' | 'all' = '1w';
accelerationStats$: Observable<AccelerationStats>;
blocksInPeriod: number = 7 * 144;
@@ -35,6 +35,9 @@ export class AccelerationStatsComponent implements OnInit, OnChanges {
updateStats(): void {
this.accelerationStats$ = this.servicesApiService.getAccelerationStats$({ timeframe: this.timespan });
switch (this.timespan) {
case '24h':
this.blocksInPeriod = 144;
break;
case '3d':
this.blocksInPeriod = 3 * 144;
break;
@@ -44,6 +47,9 @@ export class AccelerationStatsComponent implements OnInit, OnChanges {
case '1m':
this.blocksInPeriod = 30 * 144;
break;
case 'all':
this.blocksInPeriod = Infinity;
break;
}
}
}