import React, { useEffect, useState } from "react"; import { useDispatch } from "react-redux"; import { Link } from "react-router-dom"; import { deleteProject, modalToggle } from "@redux/projectsTrackerSlice"; import { copyProjectLink } from "@utils/helper"; 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 archiveSet from "assets/icons/archive.svg"; import del from "assets/icons/delete.svg"; import edit from "assets/icons/edit.svg"; import link from "assets/icons/link.svg"; import avatarProject from "assets/images/avatarMok.png"; import "./projectTiket.scss"; export const ProjectTiket = ({ project, index }) => { const [modalSelect, setModalSelect] = useState(false); const [modalAdd, setModalAdd] = useState(false); const [acceptModalOpen, setAcceptModalOpen] = useState(false); const [path, setPath] = useState(""); const dispatch = useDispatch(); const { showNotification } = useNotification(); useEffect(() => { initListeners(); }, []); function initListeners() { document.addEventListener("click", closeByClickingOut); } function closeByClickingOut(event) { const path = event.path || (event.composedPath && event.composedPath()); if ( event && !path.find( (div) => div.classList && div.classList.contains(`project-${project.id}`) ) ) { setModalSelect(false); } } function removeProject() { apiRequest("/project/update", { method: "PUT", data: { project_id: project.id, status: 10, }, }).then(() => { dispatch(deleteProject(project)); showNotification({ show: true, text: "Проект успешно была перемещена в архив", type: "archive", }); }); } function closeAcceptModal() { setAcceptModalOpen(false); } function linkProject() {} return (
{project.name}
Открытые задачи
{project.columns.reduce( (accumulator, currentValue) => accumulator + currentValue.tasks.length, 0 )}редактировать
ссылка на проект
в архив
удалить