website cleanup

This commit is contained in:
2025-12-24 13:04:18 +01:00
parent 5e491d9724
commit a7aee42409
69 changed files with 1624 additions and 938 deletions

View File

@@ -1,4 +1,4 @@
import { describe, it, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import { AvailableLeaguesViewModel, AvailableLeagueViewModel } from './AvailableLeaguesViewModel';
describe('AvailableLeaguesViewModel', () => {
@@ -22,9 +22,9 @@ describe('AvailableLeaguesViewModel', () => {
expect(vm.leagues).toHaveLength(1);
expect(vm.leagues[0]).toBeInstanceOf(AvailableLeagueViewModel);
expect(vm.leagues[0].id).toBe(baseLeague.id);
expect(vm.leagues[0].name).toBe(baseLeague.name);
expect(vm.leagues[0].avgViewsPerRace).toBe(baseLeague.avgViewsPerRace);
expect(vm.leagues[0]?.id).toBe(baseLeague.id);
expect(vm.leagues[0]?.name).toBe(baseLeague.name);
expect(vm.leagues[0]?.avgViewsPerRace).toBe(baseLeague.avgViewsPerRace);
});
it('exposes formatted average views and CPM for main sponsor slot', () => {

View File

@@ -90,7 +90,7 @@ export interface DriverProfileExtendedProfileViewModel {
openToRequests: boolean;
}
export interface DriverProfileViewModel {
export interface DriverProfileViewModelData {
currentDriver: DriverProfileDriverSummaryViewModel | null;
stats: DriverProfileStatsViewModel | null;
finishDistribution: DriverProfileFinishDistributionViewModel | null;
@@ -106,7 +106,7 @@ export interface DriverProfileViewModel {
* Transforms API DTOs into UI-ready data structures.
*/
export class DriverProfileViewModel {
constructor(private readonly dto: DriverProfileViewModel) {}
constructor(private readonly dto: DriverProfileViewModelData) {}
get currentDriver(): DriverProfileDriverSummaryViewModel | null {
return this.dto.currentDriver;
@@ -135,7 +135,7 @@ export class DriverProfileViewModel {
/**
* Get the raw DTO for serialization or further processing
*/
toDTO(): DriverProfileViewModel {
toDTO(): DriverProfileViewModelData {
return this.dto;
}
}

View File

@@ -43,11 +43,11 @@ export class LeagueDetailPageViewModel {
settings: {
maxDrivers?: number;
};
socialLinks?: {
socialLinks: {
discordUrl?: string;
youtubeUrl?: string;
websiteUrl?: string;
};
} | undefined;
// Owner info
owner: GetDriverOutputDTO | null;
@@ -103,13 +103,13 @@ export class LeagueDetailPageViewModel {
) {
this.id = league.id;
this.name = league.name;
this.description = league.description;
this.description = league.description ?? '';
this.ownerId = league.ownerId;
this.createdAt = league.createdAt;
this.createdAt = ''; // Not provided by API
this.settings = {
maxDrivers: league.maxDrivers,
maxDrivers: league.maxMembers,
};
this.socialLinks = league.socialLinks;
this.socialLinks = undefined;
this.owner = owner;
this.scoringConfig = scoringConfig;

View File

@@ -0,0 +1,24 @@
/**
* League Page Detail View Model
*
* View model for league page details.
*/
export class LeaguePageDetailViewModel {
id: string;
name: string;
description: string;
ownerId: string;
ownerName: string;
isAdmin: boolean;
mainSponsor: { name: string; logoUrl: string; websiteUrl: string } | null;
constructor(data: any) {
this.id = data.id;
this.name = data.name;
this.description = data.description;
this.ownerId = data.ownerId;
this.ownerName = data.ownerName;
this.isAdmin = data.isAdmin;
this.mainSponsor = data.mainSponsor;
}
}

View File

@@ -1,4 +1,4 @@
import type { LeagueScoringPresetDTO } from '@core/racing/application/ports/LeagueScoringPresetProvider';
import type { LeagueScoringPresetDTO } from '@/lib/types/generated/LeagueScoringPresetDTO';
/**
* View Model for league scoring presets

View File

@@ -1,4 +1,4 @@
import type { MembershipFeeDto } from '../types/generated';
import type { MembershipFeeDTO } from '../types/generated/MembershipFeeDTO';
export class MembershipFeeViewModel {
id: string;
@@ -10,7 +10,7 @@ export class MembershipFeeViewModel {
createdAt: Date;
updatedAt: Date;
constructor(dto: MembershipFeeDto) {
constructor(dto: MembershipFeeDTO) {
Object.assign(this, dto);
}

View File

@@ -1,4 +1,4 @@
import type { PaymentDto } from '../types/generated';
import type { PaymentDTO } from '../types/generated/PaymentDto';
export class PaymentViewModel {
id: string;

View File

@@ -13,7 +13,7 @@ export class StandingEntryViewModel {
private currentUserId: string;
private previousPosition?: number;
constructor(dto: LeagueStandingDTO & { position: number; points: number; wins?: number; podiums?: number; races?: number }, leaderPoints: number, nextPoints: number, currentUserId: string, previousPosition?: number) {
constructor(dto: LeagueStandingDTO, leaderPoints: number, nextPoints: number, currentUserId: string, previousPosition?: number) {
this.driverId = dto.driverId;
this.position = dto.position;
this.points = dto.points;