Files
gridpilot.gg/apps/website/lib/view-models/SponsorViewModel.ts
2025-12-18 00:08:47 +01:00

36 lines
784 B
TypeScript

// Note: No generated DTO available for Sponsor yet
interface SponsorDTO {
id: string;
name: string;
logoUrl?: string;
websiteUrl?: string;
}
export class SponsorViewModel {
id: string;
name: string;
logoUrl?: string;
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';
}
}