website refactor
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO';
|
||||
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
|
||||
import { RatingDisplay } from '@/lib/display-objects/RatingDisplay';
|
||||
import { NumberDisplay } from '@/lib/display-objects/NumberDisplay';
|
||||
|
||||
export class DriversViewDataBuilder {
|
||||
static build(dto: DriversLeaderboardDTO): DriversViewData {
|
||||
@@ -8,6 +10,7 @@ export class DriversViewDataBuilder {
|
||||
id: driver.id,
|
||||
name: driver.name,
|
||||
rating: driver.rating,
|
||||
ratingLabel: RatingDisplay.format(driver.rating),
|
||||
skillLevel: driver.skillLevel,
|
||||
category: driver.category,
|
||||
nationality: driver.nationality,
|
||||
@@ -19,8 +22,12 @@ export class DriversViewDataBuilder {
|
||||
avatarUrl: driver.avatarUrl,
|
||||
})),
|
||||
totalRaces: dto.totalRaces,
|
||||
totalRacesLabel: NumberDisplay.format(dto.totalRaces),
|
||||
totalWins: dto.totalWins,
|
||||
totalWinsLabel: NumberDisplay.format(dto.totalWins),
|
||||
activeCount: dto.activeCount,
|
||||
activeCountLabel: NumberDisplay.format(dto.activeCount),
|
||||
totalDriversLabel: NumberDisplay.format(dto.drivers.length),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user