fix data flow issues

This commit is contained in:
2025-12-19 23:18:53 +01:00
parent ec177a75ce
commit 5c74837d73
45 changed files with 2726 additions and 746 deletions

View File

@@ -0,0 +1,49 @@
/**
* Renewal Alert View Model
*
* View model for upcoming renewal alerts.
*/
export class RenewalAlertViewModel {
id: string;
name: string;
type: 'league' | 'team' | 'driver' | 'race' | 'platform';
renewDate: Date;
price: number;
constructor(data: any) {
this.id = data.id;
this.name = data.name;
this.type = data.type;
this.renewDate = new Date(data.renewDate);
this.price = data.price;
}
get formattedPrice(): string {
return `$${this.price}`;
}
get formattedRenewDate(): string {
return this.renewDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
}
get typeIcon() {
const icons = {
league: 'Trophy',
team: 'Users',
driver: 'Car',
race: 'Flag',
platform: 'Megaphone',
};
return icons[this.type] || 'Trophy';
}
get daysUntilRenewal(): number {
const now = new Date();
const diffTime = this.renewDate.getTime() - now.getTime();
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
}
get isUrgent(): boolean {
return this.daysUntilRenewal <= 30;
}
}