import React, { useEffect, useState } from "react"; import {Link} from "react-router-dom"; import ModalSettings from "../UI/ModalSettings/ModalSettings"; import link from "../../images/link.svg"; import archiveSet from "../../images/archive.svg"; import del from "../../images/delete.svg"; import edit from "../../images/edit.svg"; import {apiRequest} from "../../api/request"; import {useDispatch} from "react-redux"; import { deleteProject } from "../../redux/projectsTrackerSlice"; import "./projectTiket.scss"; export const ProjectTiket = ({ project, index }) => { const [modalSettings, setModalSettings] = 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")) ) { setModalSettings(false); } } function removeProject() { apiRequest('/project/update', { method: 'PUT', data: { project_id: project.id, status: 0 } }).then((res) => { dispatch(deleteProject(project)) }) } return (
{project.name}

Открытые задачи

{project.columns.reduce((accumulator, currentValue) => accumulator + currentValue.tasks.length, 0)} {/*{project.columns.length ? '+' : ''}*/} setModalSettings(true)}> ...

редактировать

ссылка на проект

в архив

удалить

); }; export default ProjectTiket;