'use client'; import type { EventRules } from '@/lib/schemas/config'; interface EventRulesEditorProps { formData: EventRules; disabled?: boolean; onFormDataChange: (data: EventRules) => void; } const numberFields = [ { key: 'pitWindowLengthSec' as keyof EventRules, label: 'Pit Window Length (seconds)', min: -1 }, { key: 'driverStintTimeSec' as keyof EventRules, label: 'Driver Stint Time (seconds)', min: -1 }, { key: 'mandatoryPitstopCount' as keyof EventRules, label: 'Mandatory Pitstop Count', min: 0, max: 5 }, { key: 'maxTotalDrivingTime' as keyof EventRules, label: 'Max Total Driving Time (seconds)', min: -1 }, { key: 'maxDriversCount' as keyof EventRules, label: 'Max Drivers Count', min: 1, max: 10 }, { key: 'tyreSetCount' as keyof EventRules, label: 'Tyre Set Count', min: 0, max: 50 } ]; const booleanFields = [ { key: 'isRefuellingAllowedInRace' as keyof EventRules, label: 'Refuelling Allowed in Race' }, { key: 'isRefuellingTimeFixed' as keyof EventRules, label: 'Refuelling Time Fixed' }, { key: 'isMandatoryPitstopRefuellingRequired' as keyof EventRules, label: 'Mandatory Pitstop Refuelling Required' }, { key: 'isMandatoryPitstopTyreChangeRequired' as keyof EventRules, label: 'Mandatory Pitstop Tyre Change Required' }, { key: 'isMandatoryPitstopSwapDriverRequired' as keyof EventRules, label: 'Mandatory Pitstop Swap Driver Required' } ]; export function EventRulesEditor({ formData, disabled, onFormDataChange }: EventRulesEditorProps) { const handleInputChange = (key: keyof EventRules, value: number) => { onFormDataChange({ ...formData, [key]: value }); }; return (

Race Rules

{numberFields.map(({ key, label, min, max }) => (
handleInputChange(key, parseInt(e.target.value) || 0)} className="form-input w-full" min={min} max={max} />
))}

Pitstop & Refuelling Rules

{booleanFields.map(({ key, label }) => (
))}
); }