diff --git a/apps/page/components/roadmap/TriageSubmissionModal.tsx b/apps/page/components/roadmap/TriageSubmissionModal.tsx new file mode 100644 index 0000000..6f03df9 --- /dev/null +++ b/apps/page/components/roadmap/TriageSubmissionModal.tsx @@ -0,0 +1,148 @@ +import { Dialog } from "@headlessui/react"; +import { XIcon } from "@heroicons/react/outline"; +import { useState } from "react"; +import { httpPost } from "../../utils/http"; + +interface TriageSubmissionModalProps { + isOpen: boolean; + onClose: () => void; + boardId: string; + onSuccess?: () => void; +} + +export default function TriageSubmissionModal({ + isOpen, + onClose, + boardId, + onSuccess, +}: TriageSubmissionModalProps) { + const [title, setTitle] = useState(""); + const [description, setDescription] = useState(""); + const [isLoading, setIsLoading] = useState(false); + const [error, setError] = useState(""); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setIsLoading(true); + setError(""); + + try { + await httpPost({ + url: "/api/roadmap/submit-triage", + data: { + board_id: boardId, + title: title.trim(), + description: description.trim() || null, + }, + }); + + setTitle(""); + setDescription(""); + onSuccess?.(); + onClose(); + } catch (err) { + setError( + err instanceof Error + ? err.message + : "Something went wrong. Please try again." + ); + } finally { + setIsLoading(false); + } + }; + + const handleClose = () => { + if (isLoading) return; + setTitle(""); + setDescription(""); + setError(""); + onClose(); + }; + + return ( + +