32 lines
844 B
TypeScript
32 lines
844 B
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import type { SponsorViewData } from "../view-data/SponsorViewData";
|
|
|
|
export class SponsorViewModel extends ViewModel {
|
|
private readonly data: SponsorViewData;
|
|
|
|
constructor(data: SponsorViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get id(): string { return this.data.id; }
|
|
get name(): string { return this.data.name; }
|
|
get logoUrl(): string | undefined { return this.data.logoUrl; }
|
|
get websiteUrl(): string | undefined { return this.data.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';
|
|
}
|
|
}
|