view data fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ViewData } from '@/lib/contracts/view-data/ViewData';
|
||||
import { ViewData } from '../contracts/view-data/ViewData';
|
||||
|
||||
/**
|
||||
* AdminDashboardViewData
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ViewData } from '@/lib/contracts/view-data/ViewData';
|
||||
import { ViewData } from '../contracts/view-data/ViewData';
|
||||
|
||||
export interface LiveRaceData {
|
||||
id: string;
|
||||
@@ -64,7 +64,14 @@ export interface RecentResult {
|
||||
finishedAt: string;
|
||||
}
|
||||
|
||||
import type { LeagueViewData } from './LeagueViewData';
|
||||
import type { DriverViewData } from './DriverViewData';
|
||||
import type { RaceViewData } from './RaceViewData';
|
||||
|
||||
export interface LeagueDetailViewData extends ViewData {
|
||||
league: LeagueViewData;
|
||||
drivers: Array<DriverViewData & { impressions: number }>;
|
||||
races: Array<RaceViewData & { views: number }>;
|
||||
leagueId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
|
||||
@@ -1,7 +1,26 @@
|
||||
import { ViewData } from "@/lib/contracts/view-data/ViewData";
|
||||
|
||||
/**
|
||||
* ViewData for LeagueSchedule
|
||||
* This is the JSON-serializable input for the Template.
|
||||
*/
|
||||
export interface LeagueScheduleViewData {
|
||||
races: any[];
|
||||
export interface LeagueScheduleViewData extends ViewData {
|
||||
leagueId: string;
|
||||
races: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
scheduledAt: string;
|
||||
track: string;
|
||||
car: string;
|
||||
sessionType: string;
|
||||
isPast: boolean;
|
||||
isUpcoming: boolean;
|
||||
status: string;
|
||||
isUserRegistered: boolean;
|
||||
canRegister: boolean;
|
||||
canEdit: boolean;
|
||||
canReschedule: boolean;
|
||||
}>;
|
||||
currentDriverId?: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,50 @@
|
||||
import type { StandingEntryViewData } from './StandingEntryViewData';
|
||||
import { ViewData } from "@/lib/contracts/view-data/ViewData";
|
||||
|
||||
/**
|
||||
* ViewData for StandingEntry
|
||||
* This is the JSON-serializable input for the Template.
|
||||
*/
|
||||
export interface StandingEntryViewData {
|
||||
driverId: string;
|
||||
position: number;
|
||||
points: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
races: number;
|
||||
leaderPoints: number;
|
||||
nextPoints: number;
|
||||
currentUserId: string | null;
|
||||
previousPosition?: number;
|
||||
driver?: any;
|
||||
// Phase 3 fields
|
||||
positionChange: number;
|
||||
lastRacePoints: number;
|
||||
droppedRaceIds: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* ViewData for LeagueStandings
|
||||
* This is the JSON-serializable input for the Template.
|
||||
*/
|
||||
export interface LeagueStandingsViewData {
|
||||
export interface LeagueStandingsViewData extends ViewData {
|
||||
standings: StandingEntryViewData[];
|
||||
drivers: any[];
|
||||
memberships: any[];
|
||||
drivers: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl: string | null;
|
||||
iracingId: string;
|
||||
rating?: number;
|
||||
country: string;
|
||||
}>;
|
||||
memberships: Array<{
|
||||
driverId: string;
|
||||
leagueId: string;
|
||||
role: 'owner' | 'admin' | 'steward' | 'member';
|
||||
joinedAt: string;
|
||||
status: 'active' | 'inactive';
|
||||
}>;
|
||||
leagueId: string;
|
||||
currentDriverId: string | null;
|
||||
isAdmin: boolean;
|
||||
isTeamChampionship: boolean;
|
||||
}
|
||||
|
||||
38
apps/website/lib/view-data/LeagueViewData.ts
Normal file
38
apps/website/lib/view-data/LeagueViewData.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ViewData } from "../contracts/view-data/ViewData";
|
||||
|
||||
export interface LeagueViewData extends ViewData {
|
||||
id: string;
|
||||
name: string;
|
||||
game: string;
|
||||
tier: 'premium' | 'standard' | 'starter';
|
||||
season: string;
|
||||
description: string;
|
||||
drivers: number;
|
||||
races: number;
|
||||
completedRaces: number;
|
||||
totalImpressions: number;
|
||||
avgViewsPerRace: number;
|
||||
engagement: number;
|
||||
rating: number;
|
||||
seasonStatus: 'active' | 'upcoming' | 'completed';
|
||||
seasonDates: {
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
nextRace?: {
|
||||
name: string;
|
||||
date: string;
|
||||
track: string;
|
||||
};
|
||||
sponsorSlots: {
|
||||
main: {
|
||||
price: number;
|
||||
status: 'available' | 'occupied';
|
||||
};
|
||||
secondary: {
|
||||
price: number;
|
||||
total: number;
|
||||
occupied: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,16 +1,22 @@
|
||||
import { ViewData } from "@/lib/contracts/view-data/ViewData";
|
||||
import type { WalletTransactionViewData } from './WalletTransactionViewData';
|
||||
|
||||
/**
|
||||
* ViewData for LeagueWallet
|
||||
* This is the JSON-serializable input for the Template.
|
||||
*/
|
||||
export interface LeagueWalletViewData {
|
||||
export interface LeagueWalletViewData extends ViewData {
|
||||
leagueId: string;
|
||||
balance: number;
|
||||
currency: string;
|
||||
formattedBalance: string;
|
||||
totalRevenue: number;
|
||||
formattedTotalRevenue: string;
|
||||
totalFees: number;
|
||||
formattedTotalFees: string;
|
||||
totalWithdrawals: number;
|
||||
pendingPayouts: number;
|
||||
formattedPendingPayouts: string;
|
||||
currency: string;
|
||||
transactions: WalletTransactionViewData[];
|
||||
canWithdraw: boolean;
|
||||
withdrawalBlockReason?: string;
|
||||
|
||||
@@ -29,11 +29,11 @@ export interface LeaguesViewData extends ViewData {
|
||||
scoring: {
|
||||
gameId: string;
|
||||
gameName: string;
|
||||
primaryChampionshipType: 'driver' | 'team' | 'nations' | 'trophy';
|
||||
primaryChampionshipType: string;
|
||||
scoringPresetId: string;
|
||||
scoringPresetName: string;
|
||||
dropPolicySummary: string;
|
||||
scoringPatternSummary: string;
|
||||
} | undefined;
|
||||
}>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface ProfileViewData extends ViewData {
|
||||
bio: string | null;
|
||||
iracingId: string | null;
|
||||
joinedAtLabel: string;
|
||||
globalRankLabel: string;
|
||||
};
|
||||
stats: {
|
||||
ratingLabel: string;
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface RaceStewardingViewData {
|
||||
id: string;
|
||||
name: string;
|
||||
} | null;
|
||||
protests: Array<{
|
||||
pendingProtests: Array<{
|
||||
id: string;
|
||||
protestingDriverId: string;
|
||||
accusedDriverId: string;
|
||||
@@ -23,8 +23,21 @@ export interface RaceStewardingViewData {
|
||||
};
|
||||
filedAt: string;
|
||||
status: string;
|
||||
decisionNotes?: string;
|
||||
proofVideoUrl?: string;
|
||||
decisionNotes?: string | null;
|
||||
proofVideoUrl?: string | null;
|
||||
}>;
|
||||
resolvedProtests: Array<{
|
||||
id: string;
|
||||
protestingDriverId: string;
|
||||
accusedDriverId: string;
|
||||
incident: {
|
||||
lap: number;
|
||||
description: string;
|
||||
};
|
||||
filedAt: string;
|
||||
status: string;
|
||||
decisionNotes?: string | null;
|
||||
proofVideoUrl?: string | null;
|
||||
}>;
|
||||
penalties: Array<{
|
||||
id: string;
|
||||
@@ -32,7 +45,10 @@ export interface RaceStewardingViewData {
|
||||
type: string;
|
||||
value: number;
|
||||
reason: string;
|
||||
notes?: string;
|
||||
notes?: string | null;
|
||||
}>;
|
||||
pendingCount: number;
|
||||
resolvedCount: number;
|
||||
penaltiesCount: number;
|
||||
driverMap: Record<string, { id: string; name: string }>;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { ViewData } from "../contracts/view-data/ViewData";
|
||||
|
||||
/**
|
||||
* ViewData for SponsorDashboard
|
||||
*/
|
||||
export interface SponsorDashboardViewData {
|
||||
export interface SponsorDashboardViewData extends ViewData {
|
||||
sponsorId: string;
|
||||
sponsorName: string;
|
||||
totalImpressions: string;
|
||||
totalInvestment: string;
|
||||
activeSponsorships: number;
|
||||
metrics: {
|
||||
impressionsChange: number;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* TeamDetailViewData - Pure ViewData for TeamDetailTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
import { ViewData } from "../contracts/view-data/ViewData";
|
||||
|
||||
export interface SponsorMetric {
|
||||
@@ -27,13 +22,9 @@ export interface TeamDetailData {
|
||||
foundedDateLabel?: string;
|
||||
specialization?: string;
|
||||
region?: string;
|
||||
languages?: string[];
|
||||
languages?: string[] | null;
|
||||
category?: string;
|
||||
membership?: {
|
||||
role: string;
|
||||
joinedAt: string;
|
||||
isActive: boolean;
|
||||
} | null;
|
||||
membership?: string | null;
|
||||
canManage: boolean;
|
||||
}
|
||||
|
||||
@@ -44,7 +35,7 @@ export interface TeamMemberData {
|
||||
joinedAt: string;
|
||||
joinedAtLabel: string;
|
||||
isActive: boolean;
|
||||
avatarUrl: string;
|
||||
avatarUrl: string | null;
|
||||
}
|
||||
|
||||
export interface TeamTab {
|
||||
@@ -57,7 +48,7 @@ export interface TeamTab {
|
||||
export interface TeamDetailViewData extends ViewData {
|
||||
team: TeamDetailData;
|
||||
memberships: TeamMemberData[];
|
||||
currentDriverId: string;
|
||||
currentDriverId: string | null;
|
||||
isAdmin: boolean;
|
||||
teamMetrics: SponsorMetric[];
|
||||
tabs: TeamTab[];
|
||||
|
||||
Reference in New Issue
Block a user