website refactor
This commit is contained in:
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