Files
gridpilot.gg/apps/website/lib/view-models/SponsorViewModel.ts
Marc Mintel d97f50ed72
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 6m4s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 11:59:49 +01:00

38 lines
883 B
TypeScript

// Note: No generated DTO available for Sponsor yet
interface SponsorDTO {
id: string;
name: string;
logoUrl?: string;
websiteUrl?: string;
}
import { ViewModel } from "../contracts/view-models/ViewModel";
export class SponsorViewModel extends ViewModel {
id: string;
name: string;
declare logoUrl?: string;
declare websiteUrl?: string;
constructor(dto: SponsorDTO) {
this.id = dto.id;
this.name = dto.name;
if (dto.logoUrl !== undefined) this.logoUrl = dto.logoUrl;
if (dto.websiteUrl !== undefined) this.websiteUrl = dto.websiteUrl;
}
/** UI-specific: Display name */
get displayName(): string {
return this.name;
}
/** UI-specific: Whether has website */
get hasWebsite(): boolean {
return !!this.websiteUrl;
}
/** UI-specific: Website link text */
get websiteLinkText(): string {
return 'Visit Website';
}
}