website refactor
This commit is contained in:
46
apps/website/lib/view-data/DriverRankingsViewData.ts
Normal file
46
apps/website/lib/view-data/DriverRankingsViewData.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* DriverRankingsViewData - Pure ViewData for DriverRankingsTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface DriverRankingItem {
|
||||
id: string;
|
||||
name: string;
|
||||
rating: number;
|
||||
skillLevel: string;
|
||||
nationality: string;
|
||||
racesCompleted: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
rank: number;
|
||||
avatarUrl: string;
|
||||
winRate: string;
|
||||
medalBg: string;
|
||||
medalColor: string;
|
||||
}
|
||||
|
||||
export interface PodiumDriver {
|
||||
id: string;
|
||||
name: string;
|
||||
rating: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
avatarUrl: string;
|
||||
position: 1 | 2 | 3;
|
||||
}
|
||||
|
||||
export interface DriverRankingsViewData {
|
||||
drivers: DriverRankingItem[];
|
||||
podium: PodiumDriver[];
|
||||
searchQuery: string;
|
||||
selectedSkill: 'all' | 'pro' | 'advanced' | 'intermediate' | 'beginner';
|
||||
sortBy: 'rank' | 'rating' | 'wins' | 'podiums' | 'winRate';
|
||||
showFilters: boolean;
|
||||
onSearchChange: (query: string) => void;
|
||||
onSkillChange: (skill: 'all' | 'pro' | 'advanced' | 'intermediate' | 'beginner') => void;
|
||||
onSortChange: (sort: 'rank' | 'rating' | 'wins' | 'podiums' | 'winRate') => void;
|
||||
onToggleFilters: () => void;
|
||||
onDriverClick: (id: string) => void;
|
||||
onBackToLeaderboards: () => void;
|
||||
onClearFilters: () => void;
|
||||
}
|
||||
83
apps/website/lib/view-data/LeagueDetailViewData.ts
Normal file
83
apps/website/lib/view-data/LeagueDetailViewData.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* LeagueDetailViewData - Pure ViewData for LeagueDetailTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface LeagueInfoData {
|
||||
name: string;
|
||||
description?: string;
|
||||
membersCount: number;
|
||||
racesCount: number;
|
||||
avgSOF: number | null;
|
||||
structure: string;
|
||||
scoring: string;
|
||||
createdAt: string;
|
||||
discordUrl?: string;
|
||||
youtubeUrl?: string;
|
||||
websiteUrl?: string;
|
||||
}
|
||||
|
||||
export interface SponsorInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
tier: 'main' | 'secondary';
|
||||
logoUrl?: string;
|
||||
websiteUrl?: string;
|
||||
tagline?: string;
|
||||
}
|
||||
|
||||
export interface LiveRaceData {
|
||||
id: string;
|
||||
name: string;
|
||||
date: string;
|
||||
registeredCount?: number;
|
||||
strengthOfField?: number;
|
||||
}
|
||||
|
||||
export interface DriverSummaryData {
|
||||
driverId: string;
|
||||
driverName: string;
|
||||
avatarUrl: string | null;
|
||||
rating: number | null;
|
||||
rank: number | null;
|
||||
roleBadgeText: string;
|
||||
roleBadgeClasses: string;
|
||||
profileUrl: string;
|
||||
}
|
||||
|
||||
export interface LeagueDetailViewData {
|
||||
// Basic info
|
||||
leagueId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
|
||||
// Info card data
|
||||
info: LeagueInfoData;
|
||||
|
||||
// Live races
|
||||
runningRaces: LiveRaceData[];
|
||||
|
||||
// Sponsors
|
||||
sponsors: SponsorInfo[];
|
||||
|
||||
// Management
|
||||
ownerSummary: DriverSummaryData | null;
|
||||
adminSummaries: DriverSummaryData[];
|
||||
stewardSummaries: DriverSummaryData[];
|
||||
|
||||
// Sponsor insights (for sponsor mode)
|
||||
sponsorInsights: {
|
||||
avgViewsPerRace: number;
|
||||
engagementRate: string;
|
||||
estimatedReach: number;
|
||||
tier: 'premium' | 'standard' | 'starter';
|
||||
trustScore: number;
|
||||
discordMembers: number;
|
||||
monthlyActivity: number;
|
||||
mainSponsorAvailable: boolean;
|
||||
secondarySlotsAvailable: number;
|
||||
mainSponsorPrice: number;
|
||||
secondaryPrice: number;
|
||||
totalImpressions: number;
|
||||
} | null;
|
||||
}
|
||||
39
apps/website/lib/view-data/LeagueStandingsViewData.ts
Normal file
39
apps/website/lib/view-data/LeagueStandingsViewData.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* LeagueStandingsViewData - Pure ViewData for LeagueStandingsTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface StandingEntryData {
|
||||
driverId: string;
|
||||
position: number;
|
||||
points: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
races: number;
|
||||
}
|
||||
|
||||
export interface DriverData {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl: string | null;
|
||||
iracingId?: string;
|
||||
rating?: number;
|
||||
country?: string;
|
||||
}
|
||||
|
||||
export interface LeagueMembershipData {
|
||||
driverId: string;
|
||||
leagueId: string;
|
||||
role: 'owner' | 'admin' | 'steward' | 'member';
|
||||
joinedAt: string;
|
||||
status: 'active' | 'pending' | 'banned';
|
||||
}
|
||||
|
||||
export interface LeagueStandingsViewData {
|
||||
standings: StandingEntryData[];
|
||||
drivers: DriverData[];
|
||||
memberships: LeagueMembershipData[];
|
||||
leagueId: string;
|
||||
currentDriverId: string | null;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user