28 lines
805 B
TypeScript
28 lines
805 B
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import { DateFormatter } from "../formatters/DateFormatter";
|
|
import type { UpcomingRaceCardViewData } from "../view-data/UpcomingRaceCardViewData";
|
|
|
|
/**
|
|
* Upcoming race card view model
|
|
* UI representation of an upcoming race on the landing page.
|
|
*/
|
|
export class UpcomingRaceCardViewModel extends ViewModel {
|
|
readonly id: string;
|
|
readonly track: string;
|
|
readonly car: string;
|
|
readonly scheduledAt: string;
|
|
|
|
constructor(data: UpcomingRaceCardViewData) {
|
|
super();
|
|
this.id = data.id;
|
|
this.track = data.track;
|
|
this.car = data.car;
|
|
this.scheduledAt = data.scheduledAt;
|
|
}
|
|
|
|
/** UI-specific: formatted date label */
|
|
get formattedDate(): string {
|
|
return DateFormatter.formatMonthDay(this.scheduledAt);
|
|
}
|
|
}
|