Status selector in CreateTaskModal
Buttons: Бэклог, To Do, В работе, Ревью, Готово Default from initialStatus (column where + was clicked)
This commit is contained in:
parent
60cc538b28
commit
9e24516bd0
@ -3,6 +3,14 @@ import { useState } from "react";
|
|||||||
import type { Task } from "@/lib/api";
|
import type { Task } from "@/lib/api";
|
||||||
import { createTask } from "@/lib/api";
|
import { createTask } from "@/lib/api";
|
||||||
|
|
||||||
|
const STATUSES = [
|
||||||
|
{ key: "backlog", label: "Бэклог" },
|
||||||
|
{ key: "todo", label: "To Do" },
|
||||||
|
{ key: "in_progress", label: "В работе" },
|
||||||
|
{ key: "in_review", label: "Ревью" },
|
||||||
|
{ key: "done", label: "Готово" },
|
||||||
|
];
|
||||||
|
|
||||||
const PRIORITIES = [
|
const PRIORITIES = [
|
||||||
{ key: "low", label: "Low", color: "#737373" },
|
{ key: "low", label: "Low", color: "#737373" },
|
||||||
{ key: "medium", label: "Medium", color: "#3b82f6" },
|
{ key: "medium", label: "Medium", color: "#3b82f6" },
|
||||||
@ -22,6 +30,7 @@ interface Props {
|
|||||||
export default function CreateTaskModal({ projectId, initialStatus, parentId, parentKey, onClose, onCreated }: Props) {
|
export default function CreateTaskModal({ projectId, initialStatus, parentId, parentKey, onClose, onCreated }: Props) {
|
||||||
const [title, setTitle] = useState("");
|
const [title, setTitle] = useState("");
|
||||||
const [description, setDescription] = useState("");
|
const [description, setDescription] = useState("");
|
||||||
|
const [status, setStatus] = useState(initialStatus);
|
||||||
const [priority, setPriority] = useState("medium");
|
const [priority, setPriority] = useState("medium");
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
@ -34,7 +43,7 @@ export default function CreateTaskModal({ projectId, initialStatus, parentId, pa
|
|||||||
const task = await createTask(projectId, {
|
const task = await createTask(projectId, {
|
||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
description: description.trim() || undefined,
|
description: description.trim() || undefined,
|
||||||
status: initialStatus,
|
status,
|
||||||
priority,
|
priority,
|
||||||
parent_id: parentId,
|
parent_id: parentId,
|
||||||
});
|
});
|
||||||
@ -81,6 +90,22 @@ export default function CreateTaskModal({ projectId, initialStatus, parentId, pa
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="text-xs text-[var(--muted)] mb-1 block">Статус</label>
|
||||||
|
<div className="flex flex-wrap gap-1">
|
||||||
|
{STATUSES.map((s) => (
|
||||||
|
<button
|
||||||
|
key={s.key}
|
||||||
|
onClick={() => setStatus(s.key)}
|
||||||
|
className={`px-2 py-1 rounded text-xs transition-colors
|
||||||
|
${status === s.key ? "bg-[var(--accent)] text-white" : "bg-white/5 text-[var(--muted)] hover:bg-white/10"}`}
|
||||||
|
>
|
||||||
|
{s.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="text-xs text-[var(--muted)] mb-1 block">Приоритет</label>
|
<label className="text-xs text-[var(--muted)] mb-1 block">Приоритет</label>
|
||||||
<div className="flex gap-1">
|
<div className="flex gap-1">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user