modal accept with notifications

This commit is contained in:
2023-07-14 03:03:49 +03:00
parent 001920a840
commit 7c7ea86c8c
9 changed files with 155 additions and 112 deletions

View File

@ -3,13 +3,14 @@ import { useDispatch } from "react-redux";
import { Link } from "react-router-dom";
import { deleteProject, modalToggle } from "@redux/projectsTrackerSlice";
import {useNotification} from "@hooks/useNotification";
import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
import { ModalSelect } from "@components/Modal/ModalSelect/ModalSelect";
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal"
import archiveSet from "assets/icons/archive.svg";
import del from "assets/icons/delete.svg";
@ -23,7 +24,7 @@ export const ProjectTiket = ({ project, index }) => {
const [modalAdd, setModalAdd] = useState(false);
const [acceptModalOpen, setAcceptModalOpen] = useState(false);
const dispatch = useDispatch();
const { showNotification } = useNotification()
const { showNotification } = useNotification();
useEffect(() => {
initListeners();
@ -53,7 +54,11 @@ export const ProjectTiket = ({ project, index }) => {
},
}).then(() => {
dispatch(deleteProject(project));
showNotification({show: true, text: 'Проект успешно была перемещена в архив', type: 'archive'});
showNotification({
show: true,
text: "Проект успешно была перемещена в архив",
type: "archive",
});
});
}
@ -63,8 +68,8 @@ export const ProjectTiket = ({ project, index }) => {
);
}
function closeAcceptModal () {
setAcceptModalOpen(false)
function closeAcceptModal() {
setAcceptModalOpen(false);
}
return (
@ -107,10 +112,12 @@ export const ProjectTiket = ({ project, index }) => {
<img src={link}></img>
<p onClick={copyProjectLink}>ссылка на проект</p>
</div>
<div onClick={() => {
setModalSelect(false)
setAcceptModalOpen(true)
}}>
<div
onClick={() => {
setModalSelect(false);
setAcceptModalOpen(true);
}}
>
<img src={archiveSet}></img>
<p>в архив</p>
</div>
@ -120,12 +127,12 @@ export const ProjectTiket = ({ project, index }) => {
</div>
</div>
</ModalSelect>
{acceptModalOpen &&
{acceptModalOpen && (
<AcceptModal
closeModal={closeAcceptModal}
agreeHandler={removeProject}
closeModal={closeAcceptModal}
agreeHandler={removeProject}
/>
}
)}
</div>
);
};