view data fixes

This commit is contained in:
2026-01-23 15:30:23 +01:00
parent e22033be38
commit f8099f04bc
213 changed files with 3466 additions and 3003 deletions

View File

@@ -1,9 +1,7 @@
/**
* Renewal Alert View Model
*
* View model for upcoming renewal alerts.
*/
import { ViewModel } from "../contracts/view-models/ViewModel";
import { CurrencyDisplay } from "../display-objects/CurrencyDisplay";
import { DateDisplay } from "../display-objects/DateDisplay";
import type { RenewalAlertViewData } from "../view-data/RenewalAlertViewData";
export class RenewalAlertViewModel extends ViewModel {
id: string;
@@ -12,7 +10,8 @@ export class RenewalAlertViewModel extends ViewModel {
renewDate: Date;
price: number;
constructor(data: any) {
constructor(data: RenewalAlertViewData) {
super();
this.id = data.id;
this.name = data.name;
this.type = data.type;
@@ -21,11 +20,11 @@ export class RenewalAlertViewModel extends ViewModel {
}
get formattedPrice(): string {
return `$${this.price}`;
return CurrencyDisplay.format(this.price);
}
get formattedRenewDate(): string {
return this.renewDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
return DateDisplay.formatShort(this.renewDate);
}
get typeIcon() {
@@ -48,4 +47,4 @@ export class RenewalAlertViewModel extends ViewModel {
get isUrgent(): boolean {
return this.daysUntilRenewal <= 30;
}
}
}