website refactor
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { RaceResultDTO } from '@/lib/types/generated/RaceResultDTO';
|
||||
import { FinishDisplay } from '../display-objects/FinishDisplay';
|
||||
|
||||
export class RaceResultViewModel {
|
||||
driverId!: string;
|
||||
@@ -42,7 +43,7 @@ export class RaceResultViewModel {
|
||||
|
||||
/** UI-specific: Badge for position */
|
||||
get positionBadge(): string {
|
||||
return this.position.toString();
|
||||
return FinishDisplay.format(this.position);
|
||||
}
|
||||
|
||||
/** UI-specific: Color for incidents badge */
|
||||
@@ -66,6 +67,25 @@ export class RaceResultViewModel {
|
||||
return this.positionChange;
|
||||
}
|
||||
|
||||
get formattedPosition(): string {
|
||||
return FinishDisplay.format(this.position);
|
||||
}
|
||||
|
||||
get formattedStartPosition(): string {
|
||||
return FinishDisplay.format(this.startPosition);
|
||||
}
|
||||
|
||||
get formattedIncidents(): string {
|
||||
return `${this.incidents}x incidents`;
|
||||
}
|
||||
|
||||
get formattedPositionsGained(): string | undefined {
|
||||
if (this.position < this.startPosition) {
|
||||
return `+${this.startPosition - this.position} positions`;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Note: The generated DTO doesn't have id or raceId
|
||||
// These will need to be added when the OpenAPI spec is updated
|
||||
id: string = '';
|
||||
|
||||
Reference in New Issue
Block a user