33 lines
809 B
TypeScript
33 lines
809 B
TypeScript
import type { HomeDiscoveryViewData } from '@/lib/view-data/HomeDiscoveryViewData';
|
|
|
|
/**
|
|
* Home discovery view model
|
|
* Aggregates discovery data for the landing page.
|
|
*/
|
|
import { ViewModel } from '../contracts/view-models/ViewModel';
|
|
|
|
export class HomeDiscoveryViewModel extends ViewModel {
|
|
private readonly data: HomeDiscoveryViewData;
|
|
|
|
constructor(data: HomeDiscoveryViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get topLeagues() { return this.data.topLeagues; }
|
|
get teams() { return this.data.teams; }
|
|
get upcomingRaces() { return this.data.upcomingRaces; }
|
|
|
|
get hasTopLeagues(): boolean {
|
|
return this.topLeagues.length > 0;
|
|
}
|
|
|
|
get hasTeams(): boolean {
|
|
return this.teams.length > 0;
|
|
}
|
|
|
|
get hasUpcomingRaces(): boolean {
|
|
return this.upcomingRaces.length > 0;
|
|
}
|
|
}
|