'use client'; import type { ServerSettings } from '@/lib/schemas/config'; interface ServerSettingsEditorProps { formData: ServerSettings; disabled?: boolean; onFormDataChange: (data: ServerSettings) => void; } const textFields = [ { key: 'serverName' as keyof ServerSettings, label: 'Server Name', type: 'text' }, { key: 'adminPassword' as keyof ServerSettings, label: 'Admin Password', type: 'password' }, { key: 'password' as keyof ServerSettings, label: 'Password', type: 'password' }, { key: 'spectatorPassword' as keyof ServerSettings, label: 'Spectator Password', type: 'password' }, { key: 'centralEntryListPath' as keyof ServerSettings, label: 'Central Entry List Path', type: 'text' } ]; const carGroups = ['FreeForAll', 'GT3', 'GT4', 'GT2', 'GTC', 'TCX']; const numberFields = [ { key: 'trackMedalsRequirement' as keyof ServerSettings, label: 'Track Medals Requirement', min: 0, max: 3 }, { key: 'safetyRatingRequirement' as keyof ServerSettings, label: 'Safety Rating Requirement', min: -1, max: 99 }, { key: 'racecraftRatingRequirement' as keyof ServerSettings, label: 'Racecraft Rating Requirement', min: -1, max: 99 }, { key: 'maxCarSlots' as keyof ServerSettings, label: 'Max Car Slots', min: 1, max: 30 } ]; const selectFields = [ { key: 'dumpLeaderboards' as keyof ServerSettings, label: 'Dump Leaderboards' }, { key: 'isRaceLocked' as keyof ServerSettings, label: 'Race Locked' }, { key: 'randomizeTrackWhenEmpty' as keyof ServerSettings, label: 'Randomize Track When Empty' }, { key: 'allowAutoDQ' as keyof ServerSettings, label: 'Allow Auto DQ' }, { key: 'shortFormationLap' as keyof ServerSettings, label: 'Short Formation Lap' }, { key: 'dumpEntryList' as keyof ServerSettings, label: 'Dump Entry List' }, { key: 'ignorePrematureDisconnects' as keyof ServerSettings, label: 'Ignore Premature Disconnects' } ]; export function ServerSettingsEditor({ formData, disabled, onFormDataChange }: ServerSettingsEditorProps) { const handleInputChange = (key: keyof ServerSettings, value: string | number) => { onFormDataChange({ ...formData, [key]: value }); }; return (

Basic Settings

{textFields.map(({ key, label, type }) => (
handleInputChange(key, e.target.value)} className="form-input w-full" />
))}

Requirements & Limits

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

Race Options

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