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

10
package-lock.json generated
View File

@ -8148,9 +8148,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001458", "version": "1.0.30001597",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001597.tgz",
"integrity": "sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w==", "integrity": "sha512-7LjJvmQU6Sj7bL0j5b5WY/3n7utXUJvAe1lxhsHDbLmwX9mdL86Yjtr+5SRCyf8qME4M7pU2hswj0FpyBVCv9w==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -8159,6 +8159,10 @@
{ {
"type": "tidelift", "type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/caniuse-lite" "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
} }
] ]
}, },

View File

@ -4,10 +4,15 @@ import { backendImg } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import close from "assets/icons/closeProjectPersons.svg"; import close from "assets/icons/closeProjectPersons.svg";
const FileTracker = ({ file, setDeletedTask, taskId }) => { const FileTracker = ({ file, setDeletedTask, taskId }) => {
const [openImg, setOpenImg] = useState(false); const [openImg, setOpenImg] = useState(false);
const { showNotification } = useNotification();
function deleteFile(file) { function deleteFile(file) {
apiRequest("/file/detach", { apiRequest("/file/detach", {
method: "DELETE", method: "DELETE",
@ -17,9 +22,22 @@ const FileTracker = ({ file, setDeletedTask, taskId }) => {
entity_id: taskId, entity_id: taskId,
status: 0 status: 0
} }
}).then(() => { })
setDeletedTask(file); .then(() => {
}); setDeletedTask(file);
showNotification({
show: true,
text: "Файл успешно удален",
type: "success"
});
})
.catch(() => {
showNotification({
show: true,
text: "Ошибка при удалении файла",
type: "error"
});
});
} }
return ( return (

View File

@ -7,6 +7,8 @@ import withReactContent from "sweetalert2-react-content";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import "./form.scss"; import "./form.scss";
@ -18,6 +20,8 @@ const Form = () => {
const urlParams = useParams(); const urlParams = useParams();
const { showNotification } = useNotification();
const [status, setStatus] = useState(null); const [status, setStatus] = useState(null);
const [data, setData] = useState({ const [data, setData] = useState({
email: "", email: "",
@ -75,10 +79,23 @@ const Form = () => {
profile_id: urlParams.id, profile_id: urlParams.id,
...data ...data
} }
}).then((res) => { })
setStatus(res); .then((res) => {
setIsFetching(false); setStatus(res);
}); setIsFetching(false);
showNotification({
show: true,
text: "Отправка успешно завершена",
type: "success"
});
})
.catch(() => {
showNotification({
show: true,
text: "Ошибка отправки",
type: "error"
});
});
}; };
return ( return (

View File

@ -10,6 +10,8 @@ import { caseOfNum, removeLast, urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
import close from "assets/icons/close.png"; import close from "assets/icons/close.png";
@ -24,6 +26,7 @@ const ListEmployees = ({
setModalAdd setModalAdd
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { showNotification } = useNotification();
function deletePerson(userId) { function deletePerson(userId) {
apiRequest("/project/del-user", { apiRequest("/project/del-user", {
@ -32,9 +35,22 @@ const ListEmployees = ({
project_id: projectBoard.id, project_id: projectBoard.id,
user_id: userId 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 ( return (

View File

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

View File

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

View File

@ -34,6 +34,11 @@ export const QuizPassingInformation = ({ setStartTest, uuid, timer }) => {
} }
dispatch(setQuestions(res)); dispatch(setQuestions(res));
setStartTest(true); setStartTest(true);
showNotification({
show: true,
text: "Тест успешно запущен",
type: "success"
});
restart( restart(
moment() moment()
.add(res[0]?.time_limit.split(":")[0], "hours") .add(res[0]?.time_limit.split(":")[0], "hours")

View File

@ -6,6 +6,8 @@ import { getPartnerRequestInfo } from "@redux/outstaffingSlice";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
@ -47,6 +49,7 @@ export const PartnerAddRequest = () => {
"Выберите кол-во сотрудников" "Выберите кол-во сотрудников"
); );
const [inputs, setInputs] = useState({ title: "", description: "" }); const [inputs, setInputs] = useState({ title: "", description: "" });
const { showNotification } = useNotification();
if ( if (
currentUrl[0] === "/profile/requests-edit" && currentUrl[0] === "/profile/requests-edit" &&
@ -120,6 +123,11 @@ export const PartnerAddRequest = () => {
} }
}).then(() => { }).then(() => {
navigate("/profile/requests"); navigate("/profile/requests");
showNotification({
show: true,
text: "Вакансия успешно изменена",
type: "success"
});
}); });
} else { } else {
apiRequest("/request/create-request", { apiRequest("/request/create-request", {
@ -138,6 +146,11 @@ export const PartnerAddRequest = () => {
} }
}).then(() => { }).then(() => {
navigate("/profile/requests"); navigate("/profile/requests");
showNotification({
show: true,
text: "Вакансия успешно создана",
type: "success"
});
}); });
} }
}; };

View File

@ -14,6 +14,8 @@ import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
@ -37,6 +39,7 @@ export const PartnerBid = () => {
const requestId = useSelector(getPartnerRequestId); const requestId = useSelector(getPartnerRequestId);
const partnerRequests = useSelector(getPartnerRequests); const partnerRequests = useSelector(getPartnerRequests);
const navigate = useNavigate(); const navigate = useNavigate();
const { showNotification } = useNotification();
if (!requestId) { if (!requestId) {
return <Navigate to="/profile/requests" replace />; return <Navigate to="/profile/requests" replace />;
@ -61,6 +64,11 @@ export const PartnerBid = () => {
} }
}).then(() => { }).then(() => {
navigate("/profile/requests"); navigate("/profile/requests");
showNotification({
show: true,
text: "Вакансия удалена",
type: "success"
});
}); });
}; };

View File

@ -256,7 +256,11 @@ export const ProjectTracker = () => {
} else { } else {
dispatch(setProjectBoardFetch(projectBoard.id)); dispatch(setProjectBoardFetch(projectBoard.id));
} }
showNotification({ show: true, text: "Колонка удалена", type: "error" }); showNotification({
show: true,
text: "Колонка удалена",
type: "error"
});
}); });
} }
@ -319,6 +323,11 @@ export const ProjectTracker = () => {
...prevState, ...prevState,
add: false add: false
})); }));
showNotification({
show: true,
text: "Тег успешно создан",
type: "success"
});
}); });
}); });
} }
@ -340,6 +349,11 @@ export const ProjectTracker = () => {
})); }));
setTagInfo({ description: "", name: "" }); setTagInfo({ description: "", name: "" });
setColor("#aabbcc"); setColor("#aabbcc");
showNotification({
show: true,
text: "Тег успешно изменён",
type: "success"
});
}); });
} }
@ -353,6 +367,11 @@ export const ProjectTracker = () => {
} }
}).then(() => { }).then(() => {
dispatch(deleteTagProject(tagId)); dispatch(deleteTagProject(tagId));
showNotification({
show: true,
text: "Тег удален",
type: "success"
});
}); });
} }

View File

@ -10,6 +10,8 @@ import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
@ -37,6 +39,7 @@ export const Summary = () => {
const [selectedSkills, setSelectedSkills] = useState([]); const [selectedSkills, setSelectedSkills] = useState([]);
const [selectSkillsOpen, setSelectSkillsOpen] = useState(false); const [selectSkillsOpen, setSelectSkillsOpen] = useState(false);
const [skillsList, seSkillsList] = useState([]); const [skillsList, seSkillsList] = useState([]);
const { showNotification } = useNotification();
useEffect(() => { useEffect(() => {
apiRequest( apiRequest(
@ -72,7 +75,13 @@ export const Summary = () => {
data: { data: {
resume: summery resume: summery
} }
}).then(() => {}); }).then(() => {
showNotification({
show: true,
text: "Изменения успешно сохранены",
type: "success"
});
});
} }
return ( return (
<div className="summary"> <div className="summary">

View File

@ -12,6 +12,8 @@ import {
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
@ -38,6 +40,7 @@ export const ViewReport = () => {
const [loader, setLoader] = useState(false); const [loader, setLoader] = useState(false);
const [deleteLoader, setDeleteLoader] = useState(false); const [deleteLoader, setDeleteLoader] = useState(false);
const [reportInfo, setReportInfo] = useState({}); const [reportInfo, setReportInfo] = useState({});
const { showNotification } = useNotification();
function getReportFromDate(day) { function getReportFromDate(day) {
setLoader(true); setLoader(true);
@ -84,6 +87,11 @@ export const ViewReport = () => {
if (res) { if (res) {
window.location.replace("/profile/calendar"); window.location.replace("/profile/calendar");
} }
showNotification({
show: true,
text: "Отчет удален",
type: "success"
});
}); });
} }