do to formatters

This commit is contained in:
2026-01-24 01:07:43 +01:00
parent ae59df61eb
commit 891b3cf0ee
140 changed files with 656 additions and 1159 deletions

View File

@@ -1,10 +1,10 @@
'use client';
import type { ViewDataBuilder } from '@/lib/contracts/builders/ViewDataBuilder';
import { NumberFormatter } from '@/lib/formatters/NumberFormatter';
import { RatingFormatter } from '@/lib/formatters/RatingFormatter';
import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO';
import type { DriversViewData } from '@/lib/view-data/DriversViewData';
import { RatingDisplay } from '@/lib/display-objects/RatingDisplay';
import { NumberDisplay } from '@/lib/display-objects/NumberDisplay';
import type { ViewDataBuilder } from '@/lib/contracts/builders/ViewDataBuilder';
export class DriversViewDataBuilder {
public static build(apiDto: DriversLeaderboardDTO): DriversViewData {
@@ -13,7 +13,7 @@ export class DriversViewDataBuilder {
id: driver.id,
name: driver.name,
rating: driver.rating,
ratingLabel: RatingDisplay.format(driver.rating),
ratingLabel: RatingFormatter.format(driver.rating),
skillLevel: driver.skillLevel,
category: driver.category ?? undefined,
nationality: driver.nationality,
@@ -25,12 +25,12 @@ export class DriversViewDataBuilder {
avatarUrl: driver.avatarUrl ?? undefined,
})),
totalRaces: apiDto.totalRaces,
totalRacesLabel: NumberDisplay.format(apiDto.totalRaces),
totalRacesLabel: NumberFormatter.format(apiDto.totalRaces),
totalWins: apiDto.totalWins,
totalWinsLabel: NumberDisplay.format(apiDto.totalWins),
totalWinsLabel: NumberFormatter.format(apiDto.totalWins),
activeCount: apiDto.activeCount,
activeCountLabel: NumberDisplay.format(apiDto.activeCount),
totalDriversLabel: NumberDisplay.format(apiDto.drivers.length),
activeCountLabel: NumberFormatter.format(apiDto.activeCount),
totalDriversLabel: NumberFormatter.format(apiDto.drivers.length),
};
}
}