diff --git a/src/components/CreateTaskModal.tsx b/src/components/CreateTaskModal.tsx index 2f7de8b..0f1c93e 100644 --- a/src/components/CreateTaskModal.tsx +++ b/src/components/CreateTaskModal.tsx @@ -1,7 +1,7 @@ -import { useState } from "react"; -import type { Task } from "@/lib/api"; -import { createTask } from "@/lib/api"; +import { useState, useEffect } from "react"; +import type { Task, Member, Label } from "@/lib/api"; +import { createTask, getMembers, getLabels } from "@/lib/api"; const STATUSES = [ { key: "backlog", label: "Бэклог" }, @@ -18,6 +18,12 @@ const PRIORITIES = [ { key: "critical", label: "Critical", color: "#ef4444" }, ]; +const TYPES = [ + { key: "task", label: "Задача" }, + { key: "bug", label: "Баг" }, + { key: "feature", label: "Фича" }, +]; + interface Props { projectId: string; initialStatus: string; @@ -32,9 +38,21 @@ export default function CreateTaskModal({ projectId, initialStatus, parentId, pa const [description, setDescription] = useState(""); const [status, setStatus] = useState(initialStatus); const [priority, setPriority] = useState("medium"); + const [type, setType] = useState("task"); + const [assigneeId, setAssigneeId] = useState(""); + const [reviewerId, setReviewerId] = useState(""); + const [selectedLabels, setSelectedLabels] = useState([]); const [saving, setSaving] = useState(false); const [error, setError] = useState(""); + const [members, setMembers] = useState([]); + const [labels, setLabels] = useState([]); + + useEffect(() => { + getMembers().then(setMembers).catch(() => {}); + getLabels(projectId).then(setLabels).catch(() => {}); + }, [projectId]); + const handleSubmit = async () => { if (!title.trim()) return; setSaving(true); @@ -45,7 +63,11 @@ export default function CreateTaskModal({ projectId, initialStatus, parentId, pa description: description.trim() || undefined, status, priority, + type, parent_id: parentId, + assignee_id: assigneeId || undefined, + reviewer_id: reviewerId || undefined, + labels: selectedLabels, }); onCreated(task); onClose(); @@ -59,7 +81,7 @@ export default function CreateTaskModal({ projectId, initialStatus, parentId, pa return (
e.stopPropagation()} >

@@ -67,6 +89,7 @@ export default function CreateTaskModal({ projectId, initialStatus, parentId, pa

+ {/* Title */}
+ {/* Description */}