Files
gridpilot.gg/apps/website/lib/view-models/HomeDiscoveryViewModel.ts
Marc Mintel e22033be38
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 5m54s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 13:04:05 +01:00

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;
}
}