20 lines
540 B
TypeScript
20 lines
540 B
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import type { RaceStatsViewData } from "../view-data/RaceStatsViewData";
|
|
|
|
export class RaceStatsViewModel extends ViewModel {
|
|
private readonly data: RaceStatsViewData;
|
|
|
|
constructor(data: RaceStatsViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get totalRaces(): number { return this.data.totalRaces; }
|
|
|
|
/** UI-specific: Formatted total races */
|
|
get formattedTotalRaces(): string {
|
|
// Client-only formatting
|
|
return this.totalRaces.toLocaleString();
|
|
}
|
|
}
|