website refactor
This commit is contained in:
9
apps/website/lib/view-data/AvatarViewData.ts
Normal file
9
apps/website/lib/view-data/AvatarViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* AvatarViewData
|
||||
*
|
||||
* ViewData for avatar media rendering.
|
||||
*/
|
||||
export interface AvatarViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
9
apps/website/lib/view-data/CategoryIconViewData.ts
Normal file
9
apps/website/lib/view-data/CategoryIconViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* CategoryIconViewData
|
||||
*
|
||||
* ViewData for category icon media rendering.
|
||||
*/
|
||||
export interface CategoryIconViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
9
apps/website/lib/view-data/LeagueCoverViewData.ts
Normal file
9
apps/website/lib/view-data/LeagueCoverViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* LeagueCoverViewData
|
||||
*
|
||||
* ViewData for league cover media rendering.
|
||||
*/
|
||||
export interface LeagueCoverViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
9
apps/website/lib/view-data/LeagueLogoViewData.ts
Normal file
9
apps/website/lib/view-data/LeagueLogoViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* LeagueLogoViewData
|
||||
*
|
||||
* ViewData for league logo media rendering.
|
||||
*/
|
||||
export interface LeagueLogoViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
30
apps/website/lib/view-data/LeagueRosterAdminViewData.ts
Normal file
30
apps/website/lib/view-data/LeagueRosterAdminViewData.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* LeagueRosterAdminViewData - Pure ViewData for RosterAdminPage
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface RosterMemberData {
|
||||
driverId: string;
|
||||
driver: {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
role: string;
|
||||
joinedAt: string;
|
||||
}
|
||||
|
||||
export interface JoinRequestData {
|
||||
id: string;
|
||||
driver: {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
requestedAt: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface LeagueRosterAdminViewData {
|
||||
leagueId: string;
|
||||
members: RosterMemberData[];
|
||||
joinRequests: JoinRequestData[];
|
||||
}
|
||||
23
apps/website/lib/view-data/LeagueScheduleViewData.ts
Normal file
23
apps/website/lib/view-data/LeagueScheduleViewData.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* LeagueScheduleViewData - Pure ViewData for LeagueScheduleTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface ScheduleRaceData {
|
||||
id: string;
|
||||
name: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface LeagueScheduleViewData {
|
||||
leagueId: string;
|
||||
races: ScheduleRaceData[];
|
||||
seasons: Array<{
|
||||
seasonId: string;
|
||||
name: string;
|
||||
status: string;
|
||||
}>;
|
||||
}
|
||||
9
apps/website/lib/view-data/SponsorLogoViewData.ts
Normal file
9
apps/website/lib/view-data/SponsorLogoViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* SponsorLogoViewData
|
||||
*
|
||||
* ViewData for sponsor logo media rendering.
|
||||
*/
|
||||
export interface SponsorLogoViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
9
apps/website/lib/view-data/TeamLogoViewData.ts
Normal file
9
apps/website/lib/view-data/TeamLogoViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* TeamLogoViewData
|
||||
*
|
||||
* ViewData for team logo media rendering.
|
||||
*/
|
||||
export interface TeamLogoViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
9
apps/website/lib/view-data/TrackImageViewData.ts
Normal file
9
apps/website/lib/view-data/TrackImageViewData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* TrackImageViewData
|
||||
*
|
||||
* ViewData for track image media rendering.
|
||||
*/
|
||||
export interface TrackImageViewData {
|
||||
buffer: ArrayBuffer;
|
||||
contentType: string;
|
||||
}
|
||||
58
apps/website/lib/view-data/races/RaceDetailViewData.ts
Normal file
58
apps/website/lib/view-data/races/RaceDetailViewData.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Race Detail View Data
|
||||
*
|
||||
* ViewData for the race detail page template.
|
||||
* JSON-serializable, template-ready data structure.
|
||||
*/
|
||||
|
||||
export interface RaceDetailEntry {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl: string;
|
||||
country: string;
|
||||
rating?: number;
|
||||
isCurrentUser: boolean;
|
||||
}
|
||||
|
||||
export interface RaceDetailUserResult {
|
||||
position: number;
|
||||
startPosition: number;
|
||||
positionChange: number;
|
||||
incidents: number;
|
||||
isClean: boolean;
|
||||
isPodium: boolean;
|
||||
ratingChange?: number;
|
||||
}
|
||||
|
||||
export interface RaceDetailLeague {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
settings: {
|
||||
maxDrivers: number;
|
||||
qualifyingFormat: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface RaceDetailRace {
|
||||
id: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string;
|
||||
status: 'scheduled' | 'running' | 'completed' | 'cancelled';
|
||||
sessionType: string;
|
||||
}
|
||||
|
||||
export interface RaceDetailRegistration {
|
||||
isUserRegistered: boolean;
|
||||
canRegister: boolean;
|
||||
}
|
||||
|
||||
export interface RaceDetailViewData {
|
||||
race: RaceDetailRace;
|
||||
league?: RaceDetailLeague;
|
||||
entryList: RaceDetailEntry[];
|
||||
registration: RaceDetailRegistration;
|
||||
userResult?: RaceDetailUserResult;
|
||||
canReopenRace: boolean;
|
||||
}
|
||||
42
apps/website/lib/view-data/races/RaceResultsViewData.ts
Normal file
42
apps/website/lib/view-data/races/RaceResultsViewData.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Race Results View Data
|
||||
*
|
||||
* ViewData for the race results page template.
|
||||
* JSON-serializable, template-ready data structure.
|
||||
*/
|
||||
|
||||
export interface RaceResultsResult {
|
||||
position: number;
|
||||
driverId: string;
|
||||
driverName: string;
|
||||
driverAvatar: string;
|
||||
country: string;
|
||||
car: string;
|
||||
laps: number;
|
||||
time: string;
|
||||
fastestLap: string;
|
||||
points: number;
|
||||
incidents: number;
|
||||
isCurrentUser: boolean;
|
||||
}
|
||||
|
||||
export interface RaceResultsPenalty {
|
||||
driverId: string;
|
||||
driverName: string;
|
||||
type: 'time_penalty' | 'grid_penalty' | 'points_deduction' | 'disqualification' | 'warning' | 'license_points';
|
||||
value: number;
|
||||
reason: string;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface RaceResultsViewData {
|
||||
raceTrack?: string;
|
||||
raceScheduledAt?: string;
|
||||
totalDrivers?: number;
|
||||
leagueName?: string;
|
||||
raceSOF: number | null;
|
||||
results: RaceResultsResult[];
|
||||
penalties: RaceResultsPenalty[];
|
||||
pointsSystem: Record<string, number>;
|
||||
fastestLapTime: number;
|
||||
}
|
||||
52
apps/website/lib/view-data/races/RaceStewardingViewData.ts
Normal file
52
apps/website/lib/view-data/races/RaceStewardingViewData.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Race Stewarding View Data
|
||||
*
|
||||
* ViewData for the race stewarding page template.
|
||||
* JSON-serializable, template-ready data structure.
|
||||
*/
|
||||
|
||||
export interface Protest {
|
||||
id: string;
|
||||
protestingDriverId: string;
|
||||
accusedDriverId: string;
|
||||
incident: {
|
||||
lap: number;
|
||||
description: string;
|
||||
};
|
||||
filedAt: string;
|
||||
status: string;
|
||||
proofVideoUrl?: string;
|
||||
decisionNotes?: string;
|
||||
}
|
||||
|
||||
export interface Penalty {
|
||||
id: string;
|
||||
driverId: string;
|
||||
type: string;
|
||||
value: number;
|
||||
reason: string;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface Driver {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface RaceStewardingViewData {
|
||||
race?: {
|
||||
id: string;
|
||||
track: string;
|
||||
scheduledAt: string;
|
||||
} | null;
|
||||
league?: {
|
||||
id: string;
|
||||
} | null;
|
||||
pendingProtests: Protest[];
|
||||
resolvedProtests: Protest[];
|
||||
penalties: Penalty[];
|
||||
driverMap: Record<string, Driver>;
|
||||
pendingCount: number;
|
||||
resolvedCount: number;
|
||||
penaltiesCount: number;
|
||||
}
|
||||
22
apps/website/lib/view-data/races/RacesAllViewData.ts
Normal file
22
apps/website/lib/view-data/races/RacesAllViewData.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Races All View Data
|
||||
*
|
||||
* ViewData for the all races page template.
|
||||
* JSON-serializable, template-ready data structure.
|
||||
*/
|
||||
|
||||
export interface RacesAllRace {
|
||||
id: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string;
|
||||
status: 'scheduled' | 'running' | 'completed' | 'cancelled';
|
||||
sessionType: string;
|
||||
leagueId?: string;
|
||||
leagueName?: string;
|
||||
strengthOfField?: number;
|
||||
}
|
||||
|
||||
export interface RacesAllViewData {
|
||||
races: RacesAllRace[];
|
||||
}
|
||||
29
apps/website/lib/view-data/races/RacesViewData.ts
Normal file
29
apps/website/lib/view-data/races/RacesViewData.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Races View Data
|
||||
*
|
||||
* ViewData for the main races page template.
|
||||
* JSON-serializable, template-ready data structure.
|
||||
*/
|
||||
|
||||
export interface RacesRace {
|
||||
id: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string;
|
||||
status: 'scheduled' | 'running' | 'completed' | 'cancelled';
|
||||
sessionType: string;
|
||||
leagueId?: string;
|
||||
leagueName?: string;
|
||||
strengthOfField?: number;
|
||||
isUpcoming: boolean;
|
||||
isLive: boolean;
|
||||
isPast: boolean;
|
||||
}
|
||||
|
||||
export interface RacesViewData {
|
||||
races: RacesRace[];
|
||||
totalCount: number;
|
||||
scheduledRaces: RacesRace[];
|
||||
runningRaces: RacesRace[];
|
||||
completedRaces: RacesRace[];
|
||||
}
|
||||
Reference in New Issue
Block a user