'use client'; import { FileText, Users, Calendar, Trophy, Award, Info } from 'lucide-react'; import Card from '@/components/ui/Card'; import type { LeagueConfigFormModel } from '@gridpilot/racing/application'; import type { LeagueScoringPresetDTO } from '@gridpilot/racing/application/ports/LeagueScoringPresetProvider'; interface LeagueReviewSummaryProps { form: LeagueConfigFormModel; presets: LeagueScoringPresetDTO[]; } export default function LeagueReviewSummary({ form, presets }: LeagueReviewSummaryProps) { const { basics, structure, timings, scoring, championships, dropPolicy } = form; const modeLabel = structure.mode === 'solo' ? 'Drivers only (solo)' : 'Teams with fixed drivers per team'; const capacitySentence = (() => { if (structure.mode === 'solo') { if (typeof structure.maxDrivers === 'number') { return `Up to ${structure.maxDrivers} drivers`; } return 'Capacity not fully specified'; } const parts: string[] = []; if (typeof structure.maxTeams === 'number') { parts.push(`Teams: ${structure.maxTeams}`); } if (typeof structure.driversPerTeam === 'number') { parts.push(`Drivers per team: ${structure.driversPerTeam}`); } if (typeof structure.maxDrivers === 'number') { parts.push(`Max grid: ${structure.maxDrivers}`); } if (parts.length === 0) { return '—'; } return parts.join(', '); })(); const formatMinutes = (value: number | undefined) => { if (typeof value !== 'number' || value <= 0) return '—'; return `${value} min`; }; const dropRuleSentence = (() => { if (dropPolicy.strategy === 'none') { return 'All results will count towards the championship.'; } if (dropPolicy.strategy === 'bestNResults') { if (typeof dropPolicy.n === 'number' && dropPolicy.n > 0) { return `Best ${dropPolicy.n} results will count; others are ignored.`; } return 'Best N results will count; others are ignored.'; } if (dropPolicy.strategy === 'dropWorstN') { if (typeof dropPolicy.n === 'number' && dropPolicy.n > 0) { return `Worst ${dropPolicy.n} results will be dropped from the standings.`; } return 'Worst N results will be dropped from the standings.'; } return 'All results will count towards the championship.'; })(); const preset = presets.find((p) => p.id === scoring.patternId) ?? null; const scoringPresetName = preset ? preset.name : scoring.patternId ? 'Preset not found' : '—'; const scoringPatternSummary = preset?.sessionSummary ?? '—'; const dropPolicySummary = dropRuleSentence; const enabledChampionshipsLabels: string[] = []; if (championships.enableDriverChampionship) enabledChampionshipsLabels.push('Driver'); if (championships.enableTeamChampionship) enabledChampionshipsLabels.push('Team'); if (championships.enableNationsChampionship) enabledChampionshipsLabels.push('Nations Cup'); if (championships.enableTrophyChampionship) enabledChampionshipsLabels.push('Trophy'); const championshipsSummary = enabledChampionshipsLabels.length === 0 ? 'None enabled yet.' : enabledChampionshipsLabels.join(', '); const visibilityLabel = basics.visibility === 'public' ? 'Public' : 'Private'; const gameLabel = 'iRacing'; return (
Review your league configuration
Double-check all settings before creating your league. You can modify most of these later.