diff --git a/src/components/CreateTaskModal.tsx b/src/components/CreateTaskModal.tsx
index db91ba7..903dcc4 100644
--- a/src/components/CreateTaskModal.tsx
+++ b/src/components/CreateTaskModal.tsx
@@ -13,11 +13,13 @@ const PRIORITIES = [
interface Props {
projectId: string;
initialStatus: string;
+ parentId?: string;
+ parentKey?: string;
onClose: () => void;
onCreated: (task: Task) => void;
}
-export default function CreateTaskModal({ projectId, initialStatus, onClose, onCreated }: Props) {
+export default function CreateTaskModal({ projectId, initialStatus, parentId, parentKey, onClose, onCreated }: Props) {
const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
const [priority, setPriority] = useState("medium");
@@ -34,6 +36,7 @@ export default function CreateTaskModal({ projectId, initialStatus, onClose, onC
description: description.trim() || undefined,
status: initialStatus,
priority,
+ parent_id: parentId,
});
onCreated(task);
onClose();
@@ -50,7 +53,9 @@ export default function CreateTaskModal({ projectId, initialStatus, onClose, onC
className="bg-[var(--card)] border border-[var(--border)] rounded-xl w-full max-w-md p-6"
onClick={(e) => e.stopPropagation()}
>
-
Новая задача
+
+ {parentKey ? `Подзадача для ${parentKey}` : "Новая задача"}
+
diff --git a/src/components/TaskModal.tsx b/src/components/TaskModal.tsx
index 579fdea..0d3e89f 100644
--- a/src/components/TaskModal.tsx
+++ b/src/components/TaskModal.tsx
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import type { Task, Member, Step, Message, TaskLink } from "@/lib/api";
+import CreateTaskModal from "@/components/CreateTaskModal";
import {
updateTask, deleteTask, getMembers,
getSteps, createStep, updateStep, deleteStep as _deleteStepApi,
@@ -55,6 +56,7 @@ export default function TaskModal({ task, projectId: _projectId, projectSlug: _p
const [_saving, setSaving] = useState(false);
const [editingDesc, setEditingDesc] = useState(false);
const [editingTitle, setEditingTitle] = useState(false);
+ const [showCreateSubtask, setShowCreateSubtask] = useState(false);
const [confirmDelete, setConfirmDelete] = useState(false);
const [newStep, setNewStep] = useState("");
const [newComment, setNewComment] = useState("");
@@ -252,9 +254,15 @@ export default function TaskModal({ task, projectId: _projectId, projectSlug: _p
{/* Subtasks */}
- {task.subtasks && task.subtasks.length > 0 && (
-
-
Подзадачи ({task.subtasks.length})
+
+
+ Подзадачи{task.subtasks?.length ? ` (${task.subtasks.length})` : ""}
+
+
+ {task.subtasks && task.subtasks.length > 0 && (
{task.subtasks.map((sub) => (
@@ -276,7 +284,22 @@ export default function TaskModal({ task, projectId: _projectId, projectSlug: _p
))}
-
+ )}
+
+
+ {showCreateSubtask && (
+
setShowCreateSubtask(false)}
+ onCreated={(newTask) => {
+ // Refresh parent task to show new subtask
+ onUpdated({ ...task, subtasks: [...(task.subtasks || []), { id: newTask.id, key: newTask.key, title: newTask.title, status: newTask.status, assignee: newTask.assignee }] });
+ setShowCreateSubtask(false);
+ }}
+ />
)}
{/* Dependencies */}