fix: update configs according to rulebook
This commit is contained in:
@@ -88,7 +88,7 @@ export function EventConfigEditor({ formData, disabled, onFormDataChange }: Even
|
|||||||
value={formData.preRaceWaitingTimeSeconds}
|
value={formData.preRaceWaitingTimeSeconds}
|
||||||
onChange={(e) => handleInputChange('preRaceWaitingTimeSeconds', e.target.value)}
|
onChange={(e) => handleInputChange('preRaceWaitingTimeSeconds', e.target.value)}
|
||||||
className="form-input w-full"
|
className="form-input w-full"
|
||||||
min="0"
|
min="30"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,6 @@ interface EventRulesEditorProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const numberFields = [
|
const numberFields = [
|
||||||
{
|
|
||||||
key: 'qualifyStandingType' as keyof EventRules,
|
|
||||||
label: 'Qualify Standing Type',
|
|
||||||
min: -1,
|
|
||||||
max: 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'pitWindowLengthSec' as keyof EventRules,
|
key: 'pitWindowLengthSec' as keyof EventRules,
|
||||||
label: 'Pit Window Length (seconds)',
|
label: 'Pit Window Length (seconds)',
|
||||||
@@ -28,7 +22,7 @@ const numberFields = [
|
|||||||
{
|
{
|
||||||
key: 'mandatoryPitstopCount' as keyof EventRules,
|
key: 'mandatoryPitstopCount' as keyof EventRules,
|
||||||
label: 'Mandatory Pitstop Count',
|
label: 'Mandatory Pitstop Count',
|
||||||
min: -1,
|
min: 0,
|
||||||
max: 5
|
max: 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -83,6 +77,18 @@ export function EventRulesEditor({ formData, disabled, onFormDataChange }: Event
|
|||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<h3 className="border-b border-border-muted pb-2 text-sm font-semibold text-primary">Race Rules</h3>
|
<h3 className="border-b border-border-muted pb-2 text-sm font-semibold text-primary">Race Rules</h3>
|
||||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<label className="mb-1.5 block text-sm font-medium text-secondary">Qualify Standing Type</label>
|
||||||
|
<select
|
||||||
|
disabled={disabled}
|
||||||
|
value={formData.qualifyStandingType}
|
||||||
|
onChange={(e) => handleInputChange('qualifyStandingType', parseInt(e.target.value))}
|
||||||
|
className="form-select w-full"
|
||||||
|
>
|
||||||
|
<option value={1}>Fastest Lap</option>
|
||||||
|
<option value={2}>Average Lap</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
{numberFields.map(({ key, label, min, max }) => (
|
{numberFields.map(({ key, label, min, max }) => (
|
||||||
<div key={key}>
|
<div key={key}>
|
||||||
<label className="mb-1.5 block text-sm font-medium text-secondary">{label}</label>
|
<label className="mb-1.5 block text-sm font-medium text-secondary">{label}</label>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const numberFields = [
|
|||||||
{
|
{
|
||||||
key: 'trackMedalsRequirement' as keyof ServerSettings,
|
key: 'trackMedalsRequirement' as keyof ServerSettings,
|
||||||
label: 'Track Medals Requirement',
|
label: 'Track Medals Requirement',
|
||||||
min: -1,
|
min: 0,
|
||||||
max: 3
|
max: 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const serverSettingsSchema = z.object({
|
|||||||
serverName: z.string().min(3).max(150),
|
serverName: z.string().min(3).max(150),
|
||||||
adminPassword: z.string().min(6).max(50).or(z.literal('').nullable()),
|
adminPassword: z.string().min(6).max(50).or(z.literal('').nullable()),
|
||||||
carGroup: z.string().min(1).max(50),
|
carGroup: z.string().min(1).max(50),
|
||||||
trackMedalsRequirement: z.number().min(-1).max(3),
|
trackMedalsRequirement: z.number().min(0).max(3),
|
||||||
safetyRatingRequirement: z.number().min(-1).max(99),
|
safetyRatingRequirement: z.number().min(-1).max(99),
|
||||||
racecraftRatingRequirement: z.number().min(-1).max(99),
|
racecraftRatingRequirement: z.number().min(-1).max(99),
|
||||||
password: z.string().max(50).optional().or(z.literal('')),
|
password: z.string().max(50).optional().or(z.literal('')),
|
||||||
@@ -63,16 +63,17 @@ export const serverSettingsSchema = z.object({
|
|||||||
centralEntryListPath: z.string().max(255).optional().or(z.literal('')),
|
centralEntryListPath: z.string().max(255).optional().or(z.literal('')),
|
||||||
allowAutoDQ: z.number().min(0).max(1).default(0),
|
allowAutoDQ: z.number().min(0).max(1).default(0),
|
||||||
shortFormationLap: z.number().min(0).max(1).default(0),
|
shortFormationLap: z.number().min(0).max(1).default(0),
|
||||||
formationLapType: z.number().min(0).max(3).default(0),
|
dumpEntryList: z.number().min(0).max(1).default(0),
|
||||||
ignorePrematureDisconnects: z.number().min(0).max(1).default(0)
|
formationLapType: z.number().min(0).max(3).default(3),
|
||||||
|
ignorePrematureDisconnects: z.number().min(0).max(1).default(1)
|
||||||
});
|
});
|
||||||
|
|
||||||
export type ServerSettings = z.infer<typeof serverSettingsSchema>;
|
export type ServerSettings = z.infer<typeof serverSettingsSchema>;
|
||||||
|
|
||||||
export const sessionSchema = z.object({
|
export const sessionSchema = z.object({
|
||||||
hourOfDay: z.number().min(1).max(24).default(14),
|
hourOfDay: z.number().min(0).max(23).default(14),
|
||||||
dayOfWeekend: z.number().min(1).max(3).default(1),
|
dayOfWeekend: z.number().min(1).max(3).default(1),
|
||||||
timeMultiplier: z.number().min(1).max(120).default(1),
|
timeMultiplier: z.number().min(0).max(24).default(1),
|
||||||
sessionType: z.string().min(1).max(20),
|
sessionType: z.string().min(1).max(20),
|
||||||
sessionDurationMinutes: z.number().min(1).max(180).default(20)
|
sessionDurationMinutes: z.number().min(1).max(180).default(20)
|
||||||
});
|
});
|
||||||
@@ -81,7 +82,7 @@ export type Session = z.infer<typeof sessionSchema>;
|
|||||||
|
|
||||||
export const eventConfigSchema = z.object({
|
export const eventConfigSchema = z.object({
|
||||||
track: z.string().min(1).max(100),
|
track: z.string().min(1).max(100),
|
||||||
preRaceWaitingTimeSeconds: z.number().min(0).max(600).default(30),
|
preRaceWaitingTimeSeconds: z.number().min(30).max(600).default(30),
|
||||||
sessionOverTimeSeconds: z.number().min(0).max(300).default(30),
|
sessionOverTimeSeconds: z.number().min(0).max(300).default(30),
|
||||||
ambientTemp: z.number().min(0).max(50).default(24),
|
ambientTemp: z.number().min(0).max(50).default(24),
|
||||||
cloudLevel: z.number().min(0).max(1).default(0),
|
cloudLevel: z.number().min(0).max(1).default(0),
|
||||||
@@ -97,17 +98,18 @@ export const eventConfigSchema = z.object({
|
|||||||
export type EventConfig = z.infer<typeof eventConfigSchema>;
|
export type EventConfig = z.infer<typeof eventConfigSchema>;
|
||||||
|
|
||||||
export const eventRulesSchema = z.object({
|
export const eventRulesSchema = z.object({
|
||||||
qualifyStandingType: z.number().min(-1).max(1).default(0),
|
qualifyStandingType: z.number().min(1).max(2).default(1),
|
||||||
pitWindowLengthSec: z.number().min(-1).max(3600).default(30),
|
pitWindowLengthSec: z.number().min(-1).max(3600).default(-1),
|
||||||
driverStintTimeSec: z.number().min(-1).max(7200).default(30),
|
driverStintTimeSec: z.number().min(-1).max(7200).default(-1),
|
||||||
mandatoryPitstopCount: z.number().min(-1).max(5).default(0),
|
mandatoryPitstopCount: z.number().min(0).max(5).default(0),
|
||||||
maxTotalDrivingTime: z.number().min(-1).max(14400).default(60),
|
maxTotalDrivingTime: z.number().min(-1).max(14400).default(-1),
|
||||||
isRefuellingAllowedInRace: z.number().min(0).max(1).default(0),
|
maxDriversCount: z.number().min(1).max(10).default(1),
|
||||||
|
isRefuellingAllowedInRace: z.number().min(0).max(1).default(1),
|
||||||
isRefuellingTimeFixed: z.number().min(0).max(1).default(0),
|
isRefuellingTimeFixed: z.number().min(0).max(1).default(0),
|
||||||
isMandatoryPitstopRefuellingRequired: z.number().min(0).max(1).default(0),
|
isMandatoryPitstopRefuellingRequired: z.number().min(0).max(1).default(0),
|
||||||
isMandatoryPitstopTyreChangeRequired: z.number().min(0).max(1).default(0),
|
isMandatoryPitstopTyreChangeRequired: z.number().min(0).max(1).default(0),
|
||||||
isMandatoryPitstopSwapDriverRequired: z.number().min(0).max(1).default(0),
|
isMandatoryPitstopSwapDriverRequired: z.number().min(0).max(1).default(0),
|
||||||
tyreSetCount: z.number().min(0).max(50).default(0)
|
tyreSetCount: z.number().min(0).max(50).default(50)
|
||||||
});
|
});
|
||||||
|
|
||||||
export type EventRules = z.infer<typeof eventRulesSchema>;
|
export type EventRules = z.infer<typeof eventRulesSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user