33 lines
891 B
TypeScript
33 lines
891 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 {
|
|
readonly topLeagues: HomeDiscoveryViewData['topLeagues'];
|
|
readonly teams: HomeDiscoveryViewData['teams'];
|
|
readonly upcomingRaces: HomeDiscoveryViewData['upcomingRaces'];
|
|
|
|
constructor(viewData: HomeDiscoveryViewData) {
|
|
super();
|
|
this.topLeagues = viewData.topLeagues;
|
|
this.teams = viewData.teams;
|
|
this.upcomingRaces = viewData.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;
|
|
}
|
|
}
|