pop-up notifications

This commit is contained in:
2024-03-12 16:14:44 +03:00
parent 8797ba0778
commit 727d55798a
12 changed files with 186 additions and 40 deletions

View File

@ -10,6 +10,8 @@ import { caseOfNum, removeLast, urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
import close from "assets/icons/close.png";
@ -24,6 +26,7 @@ const ListEmployees = ({
setModalAdd
}) => {
const dispatch = useDispatch();
const { showNotification } = useNotification();
function deletePerson(userId) {
apiRequest("/project/del-user", {
@ -32,9 +35,22 @@ const ListEmployees = ({
project_id: projectBoard.id,
user_id: userId
}
}).then(() => {
dispatch(deletePersonOnProject(userId));
});
})
.then(() => {
dispatch(deletePersonOnProject(userId));
showNotification({
show: true,
text: "Участник успешно удален",
type: "success"
});
})
.catch(() => {
showNotification({
show: true,
text: "Ошибка удаления участника",
type: "error"
});
});
}
return (

View File

@ -118,15 +118,23 @@ export const ModalTiсket = ({
task_id: task.id,
status: 0
}
}).then(() => {
closeModal();
dispatch(setProjectBoardFetch(projectId));
showNotification({
show: true,
text: "Задача успешно была перемещена в архив",
type: "archive"
})
.then(() => {
closeModal();
dispatch(setProjectBoardFetch(projectId));
showNotification({
show: true,
text: "Задача успешно удалена",
type: "success"
});
})
.catch(() => {
showNotification({
show: true,
text: "Ошибка удаления",
type: "error"
});
});
});
}
const priority = {
@ -169,15 +177,23 @@ export const ModalTiсket = ({
title: inputsValue.title,
description: inputsValue.description
}
}).then((res) => {
setEditOpen(!editOpen);
dispatch(setProjectBoardFetch(projectId));
showNotification({
show: true,
text: "Изменения сохранены",
type: "success"
})
.then((res) => {
setEditOpen(!editOpen);
dispatch(setProjectBoardFetch(projectId));
showNotification({
show: true,
text: "Изменения сохранены",
type: "success"
});
})
.catch(() => {
showNotification({
show: true,
text: "Ошибка при сохранении изменений",
type: "error"
});
});
});
}
function createComment() {

View File

@ -137,14 +137,22 @@ export const TrackerModal = ({
: 1,
title: valueColumn
}
}).then(() => {
dispatch(setProjectBoardFetch(projectBoard.id));
showNotification({
show: true,
text: "Колонка создана",
type: "success"
})
.then(() => {
dispatch(setProjectBoardFetch(projectBoard.id));
showNotification({
show: true,
text: "Колонка успешно создана",
type: "success"
});
})
.catch(() => {
showNotification({
show: true,
text: "Ошибка при создании колонки",
type: "error"
});
});
});
setValueColumn("");
setActive(false);
}
@ -221,7 +229,7 @@ export const TrackerModal = ({
setDeadLineDate("");
showNotification({
show: true,
text: "Задача создана",
text: "Задача успешно создана",
type: "success"
});
}
@ -295,7 +303,7 @@ export const TrackerModal = ({
dispatch(editColumnName({ id: columnId, title: columnName }));
showNotification({
show: true,
text: "Колонка создана",
text: "Колонка успешно изменена",
type: "success"
});
});
@ -316,6 +324,11 @@ export const TrackerModal = ({
dispatch(setProject(result));
setActive(false);
setNameProject("");
showNotification({
show: true,
text: "Проект успешно создан",
type: "success"
});
} else {
showNotification({
show: true,