view data fixes
This commit is contained in:
@@ -1,14 +1,6 @@
|
||||
import type { SponsorDashboardDTO } from '@/lib/types/generated/SponsorDashboardDTO';
|
||||
import type { SponsorDashboardViewData } from '@/lib/view-data/SponsorDashboardViewData';
|
||||
import { CurrencyDisplay } from '@/lib/display-objects/CurrencyDisplay';
|
||||
import { NumberDisplay } from '@/lib/display-objects/NumberDisplay';
|
||||
|
||||
/**
|
||||
* Sponsor Dashboard ViewData Builder
|
||||
*
|
||||
* Transforms SponsorDashboardDTO into ViewData for templates.
|
||||
* Deterministic and side-effect free.
|
||||
*/
|
||||
import { ViewDataBuilder } from "../../contracts/builders/ViewDataBuilder";
|
||||
|
||||
export class SponsorDashboardViewDataBuilder implements ViewDataBuilder<any, any> {
|
||||
@@ -16,32 +8,10 @@ export class SponsorDashboardViewDataBuilder implements ViewDataBuilder<any, any
|
||||
return SponsorDashboardViewDataBuilder.build(input);
|
||||
}
|
||||
|
||||
static build(
|
||||
static build(apiDto: SponsorDashboardDTO): SponsorDashboardViewData {
|
||||
const totalInvestmentValue = apiDto.investment.activeSponsorships * 1000;
|
||||
|
||||
return {
|
||||
sponsorId: (apiDto as any).sponsorId || '',
|
||||
sponsorName: apiDto.sponsorName,
|
||||
totalImpressions: NumberDisplay.format(apiDto.metrics.impressions),
|
||||
totalInvestment: CurrencyDisplay.format(totalInvestmentValue),
|
||||
metrics: {
|
||||
impressionsChange: apiDto.metrics.impressions > 1000 ? 15 : -5,
|
||||
viewersChange: 8,
|
||||
exposureChange: 12,
|
||||
},
|
||||
categoryData: {
|
||||
leagues: { count: 2, countLabel: '2 active', impressions: 1500, impressionsLabel: '1,500' },
|
||||
teams: { count: 1, countLabel: '1 active', impressions: 800, impressionsLabel: '800' },
|
||||
drivers: { count: 3, countLabel: '3 active', impressions: 2200, impressionsLabel: '2,200' },
|
||||
races: { count: 1, countLabel: '1 active', impressions: 500, impressionsLabel: '500' },
|
||||
platform: { count: 0, countLabel: '0 active', impressions: 0, impressionsLabel: '0' },
|
||||
},
|
||||
sponsorships: apiDto.sponsorships,
|
||||
activeSponsorships: apiDto.investment.activeSponsorships,
|
||||
formattedTotalInvestment: CurrencyDisplay.format(totalInvestmentValue),
|
||||
costPerThousandViews: CurrencyDisplay.format(50),
|
||||
upcomingRenewals: [], // Mock empty for now
|
||||
recentActivity: [], // Mock empty for now
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user