website refactor

This commit is contained in:
2026-01-16 01:00:03 +01:00
parent ce7be39155
commit a98e3e3166
286 changed files with 5522 additions and 5261 deletions

View File

@@ -6,7 +6,7 @@
export class AvailableLeaguesViewModel {
leagues: AvailableLeagueViewModel[];
constructor(leagues: any[]) {
constructor(leagues: unknown[]) {
this.leagues = leagues.map(league => new AvailableLeagueViewModel(league));
}
}
@@ -25,19 +25,21 @@ export class AvailableLeagueViewModel {
seasonStatus: 'active' | 'upcoming' | 'completed';
description: string;
constructor(data: any) {
this.id = data.id;
this.name = data.name;
this.game = data.game;
this.drivers = data.drivers;
this.avgViewsPerRace = data.avgViewsPerRace;
this.mainSponsorSlot = data.mainSponsorSlot;
this.secondarySlots = data.secondarySlots;
this.rating = data.rating;
this.tier = data.tier;
this.nextRace = data.nextRace;
this.seasonStatus = data.seasonStatus;
this.description = data.description;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.id = d.id;
this.name = d.name;
this.game = d.game;
this.drivers = d.drivers;
this.avgViewsPerRace = d.avgViewsPerRace;
this.mainSponsorSlot = d.mainSponsorSlot;
this.secondarySlots = d.secondarySlots;
this.rating = d.rating;
this.tier = d.tier;
this.nextRace = d.nextRace;
this.seasonStatus = d.seasonStatus;
this.description = d.description;
}
get formattedAvgViews(): string {

View File

@@ -9,9 +9,9 @@ export class BillingViewModel {
stats: BillingStatsViewModel;
constructor(data: {
paymentMethods: any[];
invoices: any[];
stats: any;
paymentMethods: unknown[];
invoices: unknown[];
stats: unknown;
}) {
this.paymentMethods = data.paymentMethods.map(pm => new PaymentMethodViewModel(pm));
this.invoices = data.invoices.map(inv => new InvoiceViewModel(inv));
@@ -29,15 +29,17 @@ export class PaymentMethodViewModel {
expiryYear?: number;
bankName?: string;
constructor(data: any) {
this.id = data.id;
this.type = data.type;
this.last4 = data.last4;
this.brand = data.brand;
this.isDefault = data.isDefault;
this.expiryMonth = data.expiryMonth;
this.expiryYear = data.expiryYear;
this.bankName = data.bankName;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.id = d.id;
this.type = d.type;
this.last4 = d.last4;
this.brand = d.brand;
this.isDefault = d.isDefault;
this.expiryMonth = d.expiryMonth;
this.expiryYear = d.expiryYear;
this.bankName = d.bankName;
}
get displayLabel(): string {
@@ -68,18 +70,20 @@ export class InvoiceViewModel {
sponsorshipType: 'league' | 'team' | 'driver' | 'race' | 'platform';
pdfUrl: string;
constructor(data: any) {
this.id = data.id;
this.invoiceNumber = data.invoiceNumber;
this.date = new Date(data.date);
this.dueDate = new Date(data.dueDate);
this.amount = data.amount;
this.vatAmount = data.vatAmount;
this.totalAmount = data.totalAmount;
this.status = data.status;
this.description = data.description;
this.sponsorshipType = data.sponsorshipType;
this.pdfUrl = data.pdfUrl;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.id = d.id;
this.invoiceNumber = d.invoiceNumber;
this.date = new Date(d.date);
this.dueDate = new Date(d.dueDate);
this.amount = d.amount;
this.vatAmount = d.vatAmount;
this.totalAmount = d.totalAmount;
this.status = d.status;
this.description = d.description;
this.sponsorshipType = d.sponsorshipType;
this.pdfUrl = d.pdfUrl;
}
get formattedTotalAmount(): string {
@@ -107,13 +111,15 @@ export class BillingStatsViewModel {
activeSponsorships: number;
averageMonthlySpend: number;
constructor(data: any) {
this.totalSpent = data.totalSpent;
this.pendingAmount = data.pendingAmount;
this.nextPaymentDate = new Date(data.nextPaymentDate);
this.nextPaymentAmount = data.nextPaymentAmount;
this.activeSponsorships = data.activeSponsorships;
this.averageMonthlySpend = data.averageMonthlySpend;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.totalSpent = d.totalSpent;
this.pendingAmount = d.pendingAmount;
this.nextPaymentDate = new Date(d.nextPaymentDate);
this.nextPaymentAmount = d.nextPaymentAmount;
this.activeSponsorships = d.activeSponsorships;
this.averageMonthlySpend = d.averageMonthlySpend;
}
get formattedTotalSpent(): string {

View File

@@ -6,12 +6,12 @@ import type { LeagueJoinRequestViewModel } from './LeagueJoinRequestViewModel';
* Transform from DTO to ViewModel with UI fields
*/
export class LeagueAdminViewModel {
config: any;
config: unknown;
members: LeagueMemberViewModel[];
joinRequests: LeagueJoinRequestViewModel[];
constructor(dto: {
config: any;
config: unknown;
members: LeagueMemberViewModel[];
joinRequests: LeagueJoinRequestViewModel[];
}) {

View File

@@ -8,7 +8,7 @@ export class LeagueDetailViewModel {
drivers: DriverViewModel[];
races: RaceViewModel[];
constructor(data: { league: any; drivers: any[]; races: any[] }) {
constructor(data: { league: unknown; drivers: unknown[]; races: unknown[] }) {
this.league = new LeagueViewModel(data.league);
this.drivers = data.drivers.map(driver => new DriverViewModel(driver));
this.races = data.races.map(race => new RaceViewModel(race));
@@ -37,24 +37,26 @@ export class LeagueViewModel {
secondary: { available: number; total: number; price: number; benefits: string[] };
};
constructor(data: any) {
this.id = data.id;
this.name = data.name;
this.game = data.game;
this.tier = data.tier;
this.season = data.season;
this.description = data.description;
this.drivers = data.drivers;
this.races = data.races;
this.completedRaces = data.completedRaces;
this.totalImpressions = data.totalImpressions;
this.avgViewsPerRace = data.avgViewsPerRace;
this.engagement = data.engagement;
this.rating = data.rating;
this.seasonStatus = data.seasonStatus;
this.seasonDates = data.seasonDates;
this.nextRace = data.nextRace;
this.sponsorSlots = data.sponsorSlots;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.id = d.id;
this.name = d.name;
this.game = d.game;
this.tier = d.tier;
this.season = d.season;
this.description = d.description;
this.drivers = d.drivers;
this.races = d.races;
this.completedRaces = d.completedRaces;
this.totalImpressions = d.totalImpressions;
this.avgViewsPerRace = d.avgViewsPerRace;
this.engagement = d.engagement;
this.rating = d.rating;
this.seasonStatus = d.seasonStatus;
this.seasonDates = d.seasonDates;
this.nextRace = d.nextRace;
this.sponsorSlots = d.sponsorSlots;
}
get formattedTotalImpressions(): string {
@@ -104,14 +106,16 @@ export class DriverViewModel {
impressions: number;
team: string;
constructor(data: any) {
this.id = data.id;
this.name = data.name;
this.country = data.country;
this.position = data.position;
this.races = data.races;
this.impressions = data.impressions;
this.team = data.team;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.id = d.id;
this.name = d.name;
this.country = d.country;
this.position = d.position;
this.races = d.races;
this.impressions = d.impressions;
this.team = d.team;
}
get formattedImpressions(): string {
@@ -126,12 +130,14 @@ export class RaceViewModel {
views: number;
status: 'upcoming' | 'completed';
constructor(data: any) {
this.id = data.id;
this.name = data.name;
this.date = new Date(data.date);
this.views = data.views;
this.status = data.status;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.id = d.id;
this.name = d.name;
this.date = new Date(d.date);
this.views = d.views;
this.status = d.status;
}
get formattedDate(): string {

View File

@@ -1,6 +1,5 @@
import type { LeagueConfigFormModel } from '@/lib/types/LeagueConfigFormModel';
import type { LeagueScoringPresetDTO } from '@/lib/types/generated/LeagueScoringPresetDTO';
import { LeagueScoringPresetsViewModel } from './LeagueScoringPresetsViewModel';
import { DriverSummaryViewModel } from './DriverSummaryViewModel';
/**

View File

@@ -78,6 +78,13 @@ export class ProtestViewModel {
} else {
this.incident = null;
}
if ('proofVideoUrl' in dto) {
this.proofVideoUrl = (dto as { proofVideoUrl?: string }).proofVideoUrl || null;
}
if ('comment' in dto) {
this.comment = (dto as { comment?: string }).comment || null;
}
// Status and decision metadata are not part of the protest DTO in this build; they default to a pending, unreviewed protest
if (!('status' in dto)) {
@@ -96,4 +103,4 @@ export class ProtestViewModel {
get statusDisplay(): string {
return 'Pending';
}
}
}

View File

@@ -30,6 +30,10 @@ export class RaceViewModel {
return '';
}
get scheduledAt(): string {
return this.date;
}
get track(): string {
return 'track' in this.dto ? this.dto.track || '' : '';
}
@@ -54,4 +58,4 @@ export class RaceViewModel {
get formattedDate(): string {
return new Date(this.date).toLocaleDateString();
}
}
}

View File

@@ -8,7 +8,7 @@ export class SponsorSettingsViewModel {
notifications: NotificationSettingsViewModel;
privacy: PrivacySettingsViewModel;
constructor(data: { profile: any; notifications: any; privacy: any }) {
constructor(data: { profile: unknown; notifications: unknown; privacy: unknown }) {
this.profile = new SponsorProfileViewModel(data.profile);
this.notifications = new NotificationSettingsViewModel(data.notifications);
this.privacy = new PrivacySettingsViewModel(data.privacy);
@@ -37,18 +37,20 @@ export class SponsorProfileViewModel {
instagram: string;
};
constructor(data: any) {
this.companyName = data.companyName;
this.contactName = data.contactName;
this.contactEmail = data.contactEmail;
this.contactPhone = data.contactPhone;
this.website = data.website;
this.description = data.description;
this.logoUrl = data.logoUrl;
this.industry = data.industry;
this.address = data.address;
this.taxId = data.taxId;
this.socialLinks = data.socialLinks;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.companyName = d.companyName;
this.contactName = d.contactName;
this.contactEmail = d.contactEmail;
this.contactPhone = d.contactPhone;
this.website = d.website;
this.description = d.description;
this.logoUrl = d.logoUrl;
this.industry = d.industry;
this.address = d.address;
this.taxId = d.taxId;
this.socialLinks = d.socialLinks;
}
get fullAddress(): string {
@@ -64,13 +66,15 @@ export class NotificationSettingsViewModel {
emailNewOpportunities: boolean;
emailContractExpiry: boolean;
constructor(data: any) {
this.emailNewSponsorships = data.emailNewSponsorships;
this.emailWeeklyReport = data.emailWeeklyReport;
this.emailRaceAlerts = data.emailRaceAlerts;
this.emailPaymentAlerts = data.emailPaymentAlerts;
this.emailNewOpportunities = data.emailNewOpportunities;
this.emailContractExpiry = data.emailContractExpiry;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.emailNewSponsorships = d.emailNewSponsorships;
this.emailWeeklyReport = d.emailWeeklyReport;
this.emailRaceAlerts = d.emailRaceAlerts;
this.emailPaymentAlerts = d.emailPaymentAlerts;
this.emailNewOpportunities = d.emailNewOpportunities;
this.emailContractExpiry = d.emailContractExpiry;
}
}
@@ -80,10 +84,12 @@ export class PrivacySettingsViewModel {
showActiveSponsorships: boolean;
allowDirectContact: boolean;
constructor(data: any) {
this.publicProfile = data.publicProfile;
this.showStats = data.showStats;
this.showActiveSponsorships = data.showActiveSponsorships;
this.allowDirectContact = data.allowDirectContact;
constructor(data: unknown) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const d = data as any;
this.publicProfile = d.publicProfile;
this.showStats = d.showStats;
this.showActiveSponsorships = d.showActiveSponsorships;
this.allowDirectContact = d.allowDirectContact;
}
}

View File

@@ -1,5 +1,5 @@
import { WalletDTO } from '@/lib/types/generated/WalletDTO';
import { FullTransactionDto, WalletTransactionViewModel } from './WalletTransactionViewModel';
import { WalletTransactionViewModel } from './WalletTransactionViewModel';
export class WalletViewModel {
id: string;

View File

@@ -1,89 +0,0 @@
export * from './ActivityItemViewModel';
export * from './AnalyticsDashboardViewModel';
export * from './AnalyticsMetricsViewModel';
export * from './AvailableLeaguesViewModel';
export * from './AvatarGenerationViewModel';
export * from './AvatarViewModel';
export * from './BillingViewModel';
export * from './CompleteOnboardingViewModel';
export * from './CreateLeagueViewModel';
export * from './CreateTeamViewModel';
export * from './DeleteMediaViewModel';
export * from './DriverLeaderboardItemViewModel';
export * from './DriverLeaderboardViewModel';
export * from './DriverProfileViewModel';
export * from './DriverRegistrationStatusViewModel';
export * from './DriverSummaryViewModel';
export * from './DriverTeamViewModel';
export * from './DriverViewModel';
export * from './EmailSignupViewModel';
export * from './HomeDiscoveryViewModel';
export * from './ImportRaceResultsSummaryViewModel';
export * from './LeagueAdminViewModel';
export * from './LeagueCardViewModel';
export * from './LeagueDetailPageViewModel';
export { LeagueDetailViewModel, LeagueViewModel } from './LeagueDetailViewModel';
export * from './LeagueJoinRequestViewModel';
export * from './LeagueMembershipsViewModel';
export * from './LeagueMemberViewModel';
export * from './LeaguePageDetailViewModel';
export * from './LeagueScheduleViewModel';
export * from './LeagueScoringChampionshipViewModel';
export * from './LeagueScoringConfigViewModel';
export * from './LeagueScoringPresetsViewModel';
export * from './LeagueScoringPresetViewModel';
export * from './LeagueScoringSectionViewModel';
export * from './LeagueSettingsViewModel';
export * from './LeagueStandingsViewModel';
export * from './LeagueStatsViewModel';
export * from './LeagueStewardingViewModel';
export * from './LeagueSummaryViewModel';
export * from './LeagueWalletViewModel';
export * from './MediaViewModel';
export * from './MembershipFeeViewModel';
export * from './PaymentViewModel';
export * from './PrizeViewModel';
export * from './ProfileOverviewViewModel';
export * from './ProtestDriverViewModel';
export * from './ProtestViewModel';
export * from './RaceDetailEntryViewModel';
export * from './RaceDetailUserResultViewModel';
export * from './RaceDetailsViewModel';
export * from './RaceListItemViewModel';
export * from './RaceResultsDataTransformer';
export * from './RaceResultsDetailViewModel';
export * from './RaceResultViewModel';
export * from './RacesPageViewModel';
export * from './RaceStatsViewModel';
export * from './RaceStewardingViewModel';
export * from './RaceViewModel';
export * from './RaceWithSOFViewModel';
export * from './RecordEngagementInputViewModel';
export * from './RecordEngagementOutputViewModel';
export * from './RecordPageViewInputViewModel';
export * from './RecordPageViewOutputViewModel';
export * from './RemoveMemberViewModel';
export * from './RenewalAlertViewModel';
export * from './RequestAvatarGenerationViewModel';
export * from './ScoringConfigurationViewModel';
export * from './SessionViewModel';
export * from './SponsorSettingsViewModel';
export * from './SponsorshipDetailViewModel';
export * from './SponsorshipPricingViewModel';
export * from './SponsorshipRequestViewModel';
export * from './SponsorshipViewModel';
export * from './SponsorSponsorshipsViewModel';
export * from './SponsorViewModel';
export * from './StandingEntryViewModel';
export * from './TeamCardViewModel';
export * from './TeamDetailsViewModel';
export * from './TeamJoinRequestViewModel';
export * from './TeamMemberViewModel';
export * from './TeamSummaryViewModel';
export * from './UpcomingRaceCardViewModel';
export * from './UpdateAvatarViewModel';
export * from './UpdateTeamViewModel';
export * from './UploadMediaViewModel';
export * from './UserProfileViewModel';
export * from './WalletTransactionViewModel';
export * from './WalletViewModel';