website refactor

This commit is contained in:
2026-01-16 01:00:03 +01:00
parent ce7be39155
commit a98e3e3166
286 changed files with 5522 additions and 5261 deletions

View File

@@ -7,7 +7,7 @@ import { RaceStewardingViewData, Protest, Penalty, Driver } from '@/lib/view-dat
* Deterministic, side-effect free.
*/
export class RaceStewardingViewDataBuilder {
static build(apiDto: any): RaceStewardingViewData {
static build(apiDto: unknown): RaceStewardingViewData {
if (!apiDto) {
return {
race: null,
@@ -22,17 +22,20 @@ export class RaceStewardingViewDataBuilder {
};
}
const race = apiDto.race ? {
id: apiDto.race.id,
track: apiDto.race.track,
scheduledAt: apiDto.race.scheduledAt,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const dto = apiDto as any;
const race = dto.race ? {
id: dto.race.id,
track: dto.race.track,
scheduledAt: dto.race.scheduledAt,
} : null;
const league = apiDto.league ? {
id: apiDto.league.id,
const league = dto.league ? {
id: dto.league.id,
} : null;
const pendingProtests: Protest[] = (apiDto.pendingProtests || []).map((p: any) => ({
const pendingProtests: Protest[] = (dto.pendingProtests || []).map((p: any) => ({
id: p.id,
protestingDriverId: p.protestingDriverId,
accusedDriverId: p.accusedDriverId,
@@ -46,7 +49,7 @@ export class RaceStewardingViewDataBuilder {
decisionNotes: p.decisionNotes,
}));
const resolvedProtests: Protest[] = (apiDto.resolvedProtests || []).map((p: any) => ({
const resolvedProtests: Protest[] = (dto.resolvedProtests || []).map((p: any) => ({
id: p.id,
protestingDriverId: p.protestingDriverId,
accusedDriverId: p.accusedDriverId,
@@ -60,7 +63,7 @@ export class RaceStewardingViewDataBuilder {
decisionNotes: p.decisionNotes,
}));
const penalties: Penalty[] = (apiDto.penalties || []).map((p: any) => ({
const penalties: Penalty[] = (dto.penalties || []).map((p: any) => ({
id: p.id,
driverId: p.driverId,
type: p.type,
@@ -69,7 +72,7 @@ export class RaceStewardingViewDataBuilder {
notes: p.notes,
}));
const driverMap: Record<string, Driver> = apiDto.driverMap || {};
const driverMap: Record<string, Driver> = dto.driverMap || {};
return {
race,
@@ -78,9 +81,9 @@ export class RaceStewardingViewDataBuilder {
resolvedProtests,
penalties,
driverMap,
pendingCount: apiDto.pendingCount || pendingProtests.length,
resolvedCount: apiDto.resolvedCount || resolvedProtests.length,
penaltiesCount: apiDto.penaltiesCount || penalties.length,
pendingCount: dto.pendingCount || pendingProtests.length,
resolvedCount: dto.resolvedCount || resolvedProtests.length,
penaltiesCount: dto.penaltiesCount || penalties.length,
};
}
}