diff --git a/src/components/TaskModal.tsx b/src/components/TaskModal.tsx index 5c3e293..9f9cb18 100644 --- a/src/components/TaskModal.tsx +++ b/src/components/TaskModal.tsx @@ -1,6 +1,6 @@ "use client"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useState } from "react"; import { Task, Member, Step, Message, updateTask, deleteTask, getMembers, @@ -53,7 +53,6 @@ export default function TaskModal({ task, projectId, projectSlug, onClose, onUpd const [confirmDelete, setConfirmDelete] = useState(false); const [newStep, setNewStep] = useState(""); const [newComment, setNewComment] = useState(""); - const commentsEndRef = useRef(null); useEffect(() => { getMembers().then(setMembers).catch(() => {}); @@ -61,10 +60,6 @@ export default function TaskModal({ task, projectId, projectSlug, onClose, onUpd getMessages({ task_id: task.id }).then(setComments).catch(() => {}); }, [task.id]); - useEffect(() => { - commentsEndRef.current?.scrollIntoView({ behavior: "smooth" }); - }, [comments]); - const save = async (patch: Partial) => { setSaving(true); try { @@ -242,8 +237,18 @@ export default function TaskModal({ task, projectId, projectSlug, onClose, onUpd {/* Comments */}
Комментарии
+
+ setNewComment(e.target.value)} + onKeyDown={(e) => e.key === "Enter" && handleAddComment()} + placeholder="Написать комментарий..." + className="flex-1 bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1.5 text-sm outline-none focus:border-[var(--accent)]" + /> + +
- {comments.map((msg) => ( + {[...comments].reverse().map((msg) => (
{AUTHOR_ICON[msg.author_type] || "👤"} @@ -257,17 +262,6 @@ export default function TaskModal({ task, projectId, projectSlug, onClose, onUpd {comments.length === 0 && (
Нет комментариев
)} -
-
-
- setNewComment(e.target.value)} - onKeyDown={(e) => e.key === "Enter" && handleAddComment()} - placeholder="Написать комментарий..." - className="flex-1 bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1.5 text-sm outline-none focus:border-[var(--accent)]" - /> -