From 7ebff6d38110e3db5b02cbc7fab148c998f6fa7e Mon Sep 17 00:00:00 2001 From: Markov Date: Sat, 28 Feb 2026 00:31:37 +0100 Subject: [PATCH] Full CreateTaskModal: type, assignee, reviewer, labels All available fields at creation time: - Title, Description, Type (task/bug/feature) - Status, Priority - Assignee + Reviewer (dropdowns with all members) - Labels (toggle buttons, project-scoped) - parent_id (when creating subtask) Modal wider (max-w-lg), scrollable --- src/components/CreateTaskModal.tsx | 123 ++++++++++++++++++++++++++--- 1 file changed, 112 insertions(+), 11 deletions(-) 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 */}