'use client';
import React from 'react';
import { Card } from '@/ui/Card';
import { Box } from '@/ui/Box';
import { Stack } from '@/ui/Stack';
import { Text } from '@/ui/Text';
import { Heading } from '@/ui/Heading';
import { Grid } from '@/ui/Grid';
import { Icon } from '@/ui/Icon';
import { Surface } from '@/ui/Surface';
import { Flag, AlertCircle, Calendar, MapPin, Gavel } from 'lucide-react';
import type { StewardingViewData } from '@/lib/view-data/leagues/StewardingViewData';
interface StewardingTemplateProps {
viewData: StewardingViewData;
}
export function StewardingTemplate({ viewData }: StewardingTemplateProps) {
return (
Stewarding
Quick overview of protests and penalties across all races
{/* Stats summary */}
{/* Content */}
{viewData.races.length === 0 ? (
All Clear!
No protests or penalties to review.
) : (
{viewData.races.map((race) => (
{/* Race Header */}
{race.track}
{new Date(race.scheduledAt).toLocaleDateString()}
{race.pendingProtests.length} pending
{/* Race Content */}
{race.pendingProtests.length === 0 && race.resolvedProtests.length === 0 && race.penalties.length === 0 ? (
No items to display
) : (
{race.pendingProtests.map((protest) => {
const protester = viewData.drivers.find(d => d.id === protest.protestingDriverId);
const accused = viewData.drivers.find(d => d.id === protest.accusedDriverId);
return (
{protester?.name || 'Unknown'} vs {accused?.name || 'Unknown'}
Pending
Lap {protest.incident.lap}
•
Filed {new Date(protest.filedAt).toLocaleDateString()}
{protest.incident.description}
Review needed
);
})}
{race.penalties.map((penalty) => {
const driver = viewData.drivers.find(d => d.id === penalty.driverId);
return (
{driver?.name || 'Unknown'}
{penalty.type.replace('_', ' ').toUpperCase()}
{penalty.reason}
{penalty.type === 'time_penalty' && `+${penalty.value}s`}
{penalty.type === 'grid_penalty' && `+${penalty.value} grid`}
{penalty.type === 'points_deduction' && `-${penalty.value} pts`}
{penalty.type === 'disqualification' && 'DSQ'}
{penalty.type === 'warning' && 'Warning'}
{penalty.type === 'license_points' && `${penalty.value} LP`}
);
})}
)}
))}
)}
);
}
function StatItem({ label, value, color }: { label: string, value: string | number, color: string }) {
return (
{value}
{label}
);
}