website refactor

This commit is contained in:
2026-01-14 10:51:05 +01:00
parent 4522d41aef
commit 0d89ad027e
291 changed files with 6887 additions and 3685 deletions

View File

@@ -4,11 +4,10 @@ import type { LeaderboardsViewData } from '@/lib/view-data/LeaderboardsViewData'
export class LeaderboardsViewDataBuilder {
static build(
driversDto: { drivers: DriverLeaderboardItemDTO[] } | null,
teamsDto: { teams: TeamListItemDTO[] } | null
apiDto: { drivers: { drivers: DriverLeaderboardItemDTO[] }; teams: { teams: TeamListItemDTO[] } }
): LeaderboardsViewData {
return {
drivers: driversDto?.drivers.slice(0, 5).map((driver, index) => ({
drivers: apiDto.drivers.drivers.map(driver => ({
id: driver.id,
name: driver.name,
rating: driver.rating,
@@ -17,9 +16,9 @@ export class LeaderboardsViewDataBuilder {
wins: driver.wins,
rank: driver.rank,
avatarUrl: driver.avatarUrl || '',
position: index + 1,
})) || [],
teams: teamsDto?.teams.slice(0, 5).map((team, index) => ({
position: driver.rank,
})),
teams: apiDto.teams.teams.map(team => ({
id: team.id,
name: team.name,
tag: team.tag,
@@ -27,8 +26,8 @@ export class LeaderboardsViewDataBuilder {
category: team.category,
totalWins: team.totalWins || 0,
logoUrl: team.logoUrl || '',
position: index + 1,
})) || [],
position: 0, // API doesn't provide team ranking
})),
};
}
}