import React, { useEffect, useState } from "react"; import { useDispatch } from "react-redux"; import { Link } from "react-router-dom"; import { apiRequest } from "../../api/request"; import { deleteProject, modalToggle } from "../../redux/projectsTrackerSlice"; import { ModalSelect } from "../UI/ModalSelect/ModalSelect"; import TrackerModal from "../UI/TrackerModal/TrackerModal"; import link from "../../assets/icons/link.svg"; import archiveSet from "../../assets/icons/archive.svg"; import del from "../../assets/icons/delete.svg"; import edit from "../../assets/icons/edit.svg"; import "./projectTiket.scss"; export const ProjectTiket = ({ project, index }) => { const [modalSelect, setModalSelect] = useState(false); const [modalAdd, setModalAdd] = useState(false); const dispatch = useDispatch(); useEffect(() => { initListeners(); }, []); function initListeners() { document.addEventListener("click", closeByClickingOut); } function closeByClickingOut(event) { const path = event.path || (event.composedPath && event.composedPath()); if ( event && !path.find((item) => item.classList && item.classList.contains("project")) ) { setModalSelect(false); } } function removeProject() { apiRequest("/project/update", { method: "PUT", data: { project_id: project.id, status: 10, }, }).then((res) => { dispatch(deleteProject(project)); }); } return (
Открытые задачи
{project.columns.reduce( (accumulator, currentValue) => accumulator + currentValue.tasks.length, 0 )} setModalSelect(true)}> ...редактировать
ссылка на проект
в архив
удалить