introduce zod schemas

This commit is contained in:
Fran Jurmanović
2025-09-24 20:07:57 +02:00
parent 0cbc6935db
commit 996f1a1385
43 changed files with 798 additions and 559 deletions

View File

@@ -1,7 +1,7 @@
'use client';
import { useState } from 'react';
import type { EventConfig, Session } from '@/lib/types/config';
import type { EventConfig, Session } from '@/lib/schemas/config';
import { updateEventConfigAction } from '@/lib/actions/configuration';
interface EventConfigEditorProps {
@@ -9,6 +9,12 @@ interface EventConfigEditorProps {
config: EventConfig;
}
const sessionTypes = [
{ value: 'P', label: 'Practice' },
{ value: 'Q', label: 'Qualifying' },
{ value: 'R', label: 'Race' }
];
export function EventConfigEditor({ serverId, config }: EventConfigEditorProps) {
const [formData, setFormData] = useState<EventConfig>(config);
const [restart, setRestart] = useState(true);
@@ -90,12 +96,6 @@ export function EventConfigEditor({ serverId, config }: EventConfigEditorProps)
}));
};
const sessionTypes = [
{ value: 'P', label: 'Practice' },
{ value: 'Q', label: 'Qualifying' },
{ value: 'R', label: 'Race' }
];
return (
<form onSubmit={handleSubmit} className="max-w-4xl space-y-8">
<div className="space-y-6">