website cleanup

This commit is contained in:
2025-12-24 21:44:58 +01:00
parent 9b683a59d3
commit d78854a4c6
277 changed files with 6141 additions and 2693 deletions

View File

@@ -1,20 +1,10 @@
import { RaceListItemViewModel } from './RaceListItemViewModel';
import type { RacesPageDataRaceDTO } from '../types/generated/RacesPageDataRaceDTO';
import type { RaceListItemDTO } from './RaceListItemViewModel';
// DTO matching the backend RacesPageDataDTO
interface RacesPageDTO {
races: Array<{
id: string;
track: string;
car: string;
scheduledAt: string;
status: string;
leagueId: string;
leagueName: string;
strengthOfField: number | null;
isUpcoming: boolean;
isLive: boolean;
isPast: boolean;
}>;
races: RacesPageDataRaceDTO[];
}
/**
@@ -25,7 +15,17 @@ export class RacesPageViewModel {
races: RaceListItemViewModel[];
constructor(dto: RacesPageDTO) {
this.races = dto.races.map(r => new RaceListItemViewModel(r));
this.races = dto.races.map((r) => {
const normalized: RaceListItemDTO = {
...r,
strengthOfField: (r as any).strengthOfField ?? null,
isUpcoming: r.isUpcoming,
isLive: r.isLive,
isPast: r.isPast,
};
return new RaceListItemViewModel(normalized);
});
}
/** UI-specific: Total races */
@@ -62,4 +62,4 @@ export class RacesPageViewModel {
get completedRaces(): RaceListItemViewModel[] {
return this.races.filter(r => r.status === 'completed');
}
}
}