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,36 +1,27 @@
// Note: No generated DTO available for SponsorshipPricing yet
interface SponsorshipPricingDTO {
mainSlotPrice: number;
secondarySlotPrice: number;
currency: string;
}
/**
* Sponsorship Pricing View Model
*
* View model for sponsorship pricing data with UI-specific transformations.
*/
import { ViewModel } from "../contracts/view-models/ViewModel";
import { CurrencyDisplay } from "../display-objects/CurrencyDisplay";
import type { SponsorshipPricingViewData } from "../view-data/SponsorshipPricingViewData";
export class SponsorshipPricingViewModel extends ViewModel {
mainSlotPrice: number;
secondarySlotPrice: number;
currency: string;
constructor(dto: SponsorshipPricingDTO) {
this.mainSlotPrice = dto.mainSlotPrice;
this.secondarySlotPrice = dto.secondarySlotPrice;
this.currency = dto.currency;
constructor(data: SponsorshipPricingViewData) {
super();
this.mainSlotPrice = data.mainSlotPrice;
this.secondarySlotPrice = data.secondarySlotPrice;
this.currency = data.currency;
}
/** UI-specific: Formatted main slot price */
get formattedMainSlotPrice(): string {
return `${this.currency} ${this.mainSlotPrice.toLocaleString()}`;
return CurrencyDisplay.format(this.mainSlotPrice, this.currency);
}
/** UI-specific: Formatted secondary slot price */
get formattedSecondarySlotPrice(): string {
return `${this.currency} ${this.secondarySlotPrice.toLocaleString()}`;
return CurrencyDisplay.format(this.secondarySlotPrice, this.currency);
}
/** UI-specific: Price difference */
@@ -40,7 +31,7 @@ export class SponsorshipPricingViewModel extends ViewModel {
/** UI-specific: Formatted price difference */
get formattedPriceDifference(): string {
return `${this.currency} ${this.priceDifference.toLocaleString()}`;
return CurrencyDisplay.format(this.priceDifference, this.currency);
}
/** UI-specific: Discount percentage for secondary slot */
@@ -48,4 +39,4 @@ export class SponsorshipPricingViewModel extends ViewModel {
if (this.mainSlotPrice === 0) return 0;
return Math.round((1 - this.secondarySlotPrice / this.mainSlotPrice) * 100);
}
}
}