From d50272bbaeb30f3dbeb5a7a332817898fac9b133 Mon Sep 17 00:00:00 2001 From: Vladiysss <139554971+Vladiysss@users.noreply.github.com> Date: Sun, 1 Mar 2026 03:18:44 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8?= =?UTF-8?q?=D1=85=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - исправлена ширина задач внутри "широких" категорий - исправлена загрузка только что созданных задач - исправлено многократное создание категорий/задач при многократном нажатии по кнопке создать --- src/KBBoard.js | 42 ++++++++++++++++++++++++++++++++---------- src/css/Board.css | 7 ++++--- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/KBBoard.js b/src/KBBoard.js index c581fb4..8eaaca3 100644 --- a/src/KBBoard.js +++ b/src/KBBoard.js @@ -8,6 +8,7 @@ const KBBoard = () => { const navigate = useNavigate(); const { id } = useParams(); const [error, setError] = useState(''); + const [loading, setLoading] = useState(false) const [info, setInfo] = useState({}); const [categories, setCategories] = useState([]); @@ -88,13 +89,16 @@ const KBBoard = () => { const createTask = async (e) => { e.preventDefault(); + setLoading(true); const newTask = { category_id: taskCategori, title: taskTitle, description: taskDescription }; - axios.post('/api/boards/categories/tasks/create', newTask); + await axios.post('/api/boards/categories/tasks/create', newTask); await loadBoardData(); modalCrTask(null)(); + setLoading(false); }; const createCategory = async (e) => { e.preventDefault(); + setLoading(true); try { const newCategory = { board_id: id, title: categoryTitle}; await axios.post('/api/boards/categories/create', newCategory); @@ -103,11 +107,13 @@ const KBBoard = () => { setError(err.response.data.message) } finally { modalCrCateg(); + setLoading(false); } }; const editTask = async (e) => { e.preventDefault(); + setLoading(true); var newTask = { id: editedTask.id, update_method: "title", value: taskTitle }; await axios.put('/api/boards/categories/tasks/update', newTask); newTask = { id: editedTask.id, update_method: "description", value: taskDescription }; @@ -116,9 +122,11 @@ const KBBoard = () => { await axios.put('/api/boards/categories/tasks/update', newTask); await loadBoardData(); modalEditTask({}, null)(); + setLoading(false); }; const editCategory = async (e) => { e.preventDefault(); + setLoading(true); try { const newCategory = { id: editedCateg.id, update_method: "title", value: categoryTitle}; await axios.put('/api/boards/categories/update', newCategory); @@ -127,23 +135,28 @@ const KBBoard = () => { setError(err.response.data.message) } finally { modalEditCateg({})(); + setLoading(false); } }; const deleteCategory = async (e) => { e.preventDefault(); + setLoading(true); await axios.delete('/api/boards/categories/delete', { data: {id: editedCateg.id} }); await loadBoardData(); modalDelCateg(); modalEditCateg({})(); + setLoading(false); } const deleteTask = async (e) => { e.preventDefault(); + setLoading(true); await axios.delete('/api/boards/categories/tasks/delete', { data: { id: editedTask.id } }); await loadBoardData(); modalDelTask(); modalEditTask({},null)(); + setLoading(false); } @@ -216,8 +229,6 @@ const KBBoard = () => { - - {crCateg && (