website refactor
This commit is contained in:
@@ -1,23 +1,16 @@
|
||||
'use client';
|
||||
|
||||
import StandingsTable from '@/components/leagues/StandingsTable';
|
||||
import LeagueChampionshipStats from '@/components/leagues/LeagueChampionshipStats';
|
||||
import { LeagueChampionshipStats } from '@/components/leagues/LeagueChampionshipStats';
|
||||
import { StandingsTable } from '@/components/leagues/StandingsTable';
|
||||
import Card from '@/components/ui/Card';
|
||||
import type { LeagueMembership } from '@/lib/types/LeagueMembership';
|
||||
import type { DriverViewModel } from '@/lib/view-models/DriverViewModel';
|
||||
import type { StandingEntryViewModel } from '@/lib/view-models/StandingEntryViewModel';
|
||||
import type { LeagueStandingsViewData } from '@/lib/view-data/LeagueStandingsViewData';
|
||||
|
||||
// ============================================================================
|
||||
// TYPES
|
||||
// ============================================================================
|
||||
|
||||
interface LeagueStandingsTemplateProps {
|
||||
standings: StandingEntryViewModel[];
|
||||
drivers: DriverViewModel[];
|
||||
memberships: LeagueMembership[];
|
||||
leagueId: string;
|
||||
currentDriverId: string | null;
|
||||
isAdmin: boolean;
|
||||
viewData: LeagueStandingsViewData;
|
||||
onRemoveMember: (driverId: string) => void;
|
||||
onUpdateRole: (driverId: string, newRole: string) => void;
|
||||
loading?: boolean;
|
||||
@@ -28,12 +21,7 @@ interface LeagueStandingsTemplateProps {
|
||||
// ============================================================================
|
||||
|
||||
export function LeagueStandingsTemplate({
|
||||
standings,
|
||||
drivers,
|
||||
memberships,
|
||||
leagueId,
|
||||
currentDriverId,
|
||||
isAdmin,
|
||||
viewData,
|
||||
onRemoveMember,
|
||||
onUpdateRole,
|
||||
loading = false,
|
||||
@@ -49,38 +37,16 @@ export function LeagueStandingsTemplate({
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Championship Stats */}
|
||||
<LeagueChampionshipStats standings={standings} drivers={drivers} />
|
||||
<LeagueChampionshipStats standings={viewData.standings} drivers={viewData.drivers} />
|
||||
|
||||
<Card>
|
||||
<h2 className="text-xl font-semibold text-white mb-4">Championship Standings</h2>
|
||||
<StandingsTable
|
||||
standings={standings.map((s) => ({
|
||||
leagueId,
|
||||
driverId: s.driverId,
|
||||
position: s.position,
|
||||
totalPoints: s.points,
|
||||
racesFinished: s.races,
|
||||
racesStarted: s.races,
|
||||
avgFinish: null,
|
||||
penaltyPoints: 0,
|
||||
bonusPoints: 0,
|
||||
}) satisfies {
|
||||
leagueId: string;
|
||||
driverId: string;
|
||||
position: number;
|
||||
totalPoints: number;
|
||||
racesFinished: number;
|
||||
racesStarted: number;
|
||||
avgFinish: number | null;
|
||||
penaltyPoints: number;
|
||||
bonusPoints: number;
|
||||
teamName?: string;
|
||||
})}
|
||||
drivers={drivers}
|
||||
leagueId={leagueId}
|
||||
memberships={memberships}
|
||||
currentDriverId={currentDriverId ?? undefined}
|
||||
isAdmin={isAdmin}
|
||||
standings={viewData.standings}
|
||||
drivers={viewData.drivers}
|
||||
memberships={viewData.memberships}
|
||||
currentDriverId={viewData.currentDriverId ?? undefined}
|
||||
isAdmin={viewData.isAdmin}
|
||||
onRemoveMember={onRemoveMember}
|
||||
onUpdateRole={onUpdateRole}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user