'use client'; import type { EventConfig, Session } from '@/lib/schemas/config'; interface EventConfigEditorProps { formData: EventConfig; disabled?: boolean; onFormDataChange: (data: EventConfig) => void; } const sessionTypes = [ { value: 'P', label: 'Practice' }, { value: 'Q', label: 'Qualifying' }, { value: 'R', label: 'Race' } ]; export function EventConfigEditor({ formData, disabled, onFormDataChange }: EventConfigEditorProps) { const handleInputChange = (key: keyof EventConfig, value: string | number) => { if (key === 'sessions') return; onFormDataChange({ ...formData, [key]: typeof formData[key] === 'number' ? typeof value === 'string' ? parseFloat(value) || 0 : value : value }); }; const handleSessionChange = (index: number, field: keyof Session, value: string | number) => { const newSessions = [...formData.sessions]; newSessions[index] = { ...newSessions[index], [field]: field === 'sessionType' ? value : typeof value === 'string' ? parseFloat(value) || 0 : value }; onFormDataChange({ ...formData, sessions: newSessions }); }; const addSession = () => { const newSession: Session = { hourOfDay: 12, dayOfWeekend: 1, timeMultiplier: 1, sessionType: 'P', sessionDurationMinutes: 20 }; onFormDataChange({ ...formData, sessions: [...formData.sessions, newSession] }); }; const removeSession = (index: number) => { onFormDataChange({ ...formData, sessions: formData.sessions.filter((_, i) => i !== index) }); }; return (

Basic Event Settings

handleInputChange('preRaceWaitingTimeSeconds', e.target.value)} className="form-input w-full" min="0" />
handleInputChange('sessionOverTimeSeconds', e.target.value)} className="form-input w-full" min="0" />
handleInputChange('postQualySeconds', e.target.value)} className="form-input w-full" min="0" />
handleInputChange('postRaceSeconds', e.target.value)} className="form-input w-full" min="0" />

Weather Settings

handleInputChange('ambientTemp', e.target.value)} className="form-input w-full" min="0" max="50" />
handleInputChange('cloudLevel', e.target.value)} className="form-input w-full" min="0" max="1" step="0.01" />
handleInputChange('rain', e.target.value)} className="form-input w-full" min="0" max="1" step="0.01" />
handleInputChange('weatherRandomness', e.target.value)} className="form-input w-full" min="0" max="7" />

Sessions

{formData.sessions.map((session, index) => (

Session {index + 1}

handleSessionChange(index, 'hourOfDay', e.target.value)} className="form-input w-full text-sm" min="0" max="23" />
handleSessionChange(index, 'dayOfWeekend', e.target.value)} className="form-input w-full text-sm" min="1" max="3" />
handleSessionChange(index, 'timeMultiplier', e.target.value)} className="form-input w-full text-sm" min="1" max="24" />
handleSessionChange(index, 'sessionDurationMinutes', e.target.value) } className="form-input w-full text-sm" min="1" />
))}
); }