diff --git a/tinker_tickets_react/src/Components/CreateTicket/TicketForm.tsx b/tinker_tickets_react/src/Components/CreateTicket/TicketForm.tsx index 25b0d89..ec26c6d 100644 --- a/tinker_tickets_react/src/Components/CreateTicket/TicketForm.tsx +++ b/tinker_tickets_react/src/Components/CreateTicket/TicketForm.tsx @@ -1,73 +1,74 @@ import React, { useState } from "react"; import TicketFieldRow from "./TicketRow"; import TicketTextarea from "./TicketText"; -import type { TicketFormData } from "../../types/ticket"; +import type { CreateTicketFormData } from "../../types/ticket"; interface TicketFormProps { - onError: (msg: string | null) => void; +onError: (msg: string | null) => void; } const TicketForm: React.FC = ({ onError }) => { - const [form, setForm] = useState({ - title: "", - status: "Open", - priority: "4", - category: "General", - type: "Issue", - description: "", - }); +const [form, setForm] = useState({ +title: "", +status: "Open", +priority: "4", +category: "General", +type: "Issue", +description: "", +}); - function updateField(field: keyof TicketFormData, value: string) { - setForm(prev => ({ ...prev, [field]: value })); - } +function updateField(field: keyof CreateTicketFormData, value: string) { +setForm((prev: CreateTicketFormData) => ({ ...prev, [field]: value })); +} - function handleSubmit(e: React.FormEvent) { - e.preventDefault(); +function handleSubmit(e: React.FormEvent) { +e.preventDefault(); - if (!form.title.trim() || !form.description.trim()) { - onError("Title and description are required."); - return; - } +``` +if (!form.title.trim() || !form.description.trim()) { + onError("Title and description are required."); + return; +} - console.log("Submitting:", form); - // Later: POST to Express/PHP - } +console.log("Submitting:", form); +// Later: POST to Express/PHP +``` - return ( -
-
-
- - updateField("title", e.target.value)} - required - /> -
+} - +return (
+ updateField("title", e.target.value)} +required +/>
- updateField("description", value)} - required - /> -
+``` + -
- - -
- - ); + updateField("description", value)} + required + /> +
+ +
+ + +
+ +``` + +); }; -export default TicketForm; +export default TicketForm; \ No newline at end of file