import React, { useEffect, useRef, useState } from "react"; import { Link } from "react-router-dom"; import { ProfileHeader } from "../../components/ProfileHeader/ProfileHeader"; import { Navigation } from "../../components/Navigation/Navigation"; import { ProfileBreadcrumbs } from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { Footer } from "../../components/Footer/Footer"; import { useDispatch, useSelector } from "react-redux"; import { getProjectBoard, modalToggle, moveProjectTask, setProjectBoardFetch, setToggleTab, } from "../../redux/projectsTrackerSlice"; import ModalTicket from "../../components/UI/ModalTicket/ModalTicket"; import ModalAdd from "../../components/UI/ModalAdd/ModalAdd"; import project from "../../images/trackerProject.svg"; import tasks from "../../images/trackerTasks.svg"; import archive from "../../images/archiveTracker.svg"; import avatarTest from "../../images/AvatarTest .png"; import selectArrow from "../../images/select.svg"; import commentsBoard from "../../images/commentsBoard.svg"; import filesBoard from "../../images/filesBoard.svg"; import arrow from "../../images/arrowCalendar.png"; export const ProjectTracker = () => { const dispatch = useDispatch(); const currentUrl = useState(window.location.pathname); const projectId = currentUrl[0].split("/").at(-1); useEffect(() => { dispatch(setProjectBoardFetch(projectId)); }, []); const [modalAdd, setModalAdd] = useState(false); const [modalActiveTicket, setModalActiveTicket] = useState(false); const [selectedTicket, setSelectedTicket] = useState({}); const [selectedTab, setSelectedTab] = useState(0); const startWrapperIndexTest = useRef({}); const [wrapperHover, setWrapperHover] = useState([ false, false, false, false, ]); const projectBoard = useSelector(getProjectBoard); // function toggleMoreTasks(columnId) { // setTabTaskMok((prevArray) => // prevArray.map((elem, index) => { // if (columnId === index) { // return { ...elem, open: !elem.open }; // } else { // return elem; // } // }) // ); // } function dragStartHandler(e, task, columnId) { startWrapperIndexTest.current = { task: task, index: columnId }; setTimeout(() => { e.target.classList.add("tasks__board__item__hide"); }, 0); } function dragEndHandler(e) { setWrapperHover((prevArray) => prevArray.map((elem) => { return false; }) ); e.target.classList.remove("tasks__board__item__hide"); } function dragOverHandler(e) { e.preventDefault(); } function dragEnterHandler(columnId) { if (columnId === startWrapperIndexTest.current.index) { return; } setWrapperHover((prevArray) => prevArray.map((elem, index) => { if (index === columnId) { return true; } else { return false; } }) ); } function dragDropHandler(e, columnId) { e.preventDefault(); if (startWrapperIndexTest.current.index === columnId) { return; } setWrapperHover((prevArray) => prevArray.map((elem) => { return false; }) ); if (columnId !== startWrapperIndexTest.current.index) { dispatch( moveProjectTask({ startWrapperIndex: startWrapperIndexTest.current, columnId, }) ); } } function selectedTabTask(columnId) { setSelectedTab(columnId); dispatch(modalToggle("createTiketProject")); setModalAdd(true); } function openTicket(e, task) { setSelectedTicket(task); setModalActiveTicket(true); } return (

Управление проектами с трекером

dispatch(setToggleTab(1))} > img

Проекты

dispatch(setToggleTab(2))} > img

Все мои задачи

dispatch(setToggleTab(3))} > img

Архив

Проект : {projectBoard.name}

{ dispatch(modalToggle("createColumn")); setModalAdd(true); }} > +

добавить колонку

avatar avatar +9 { dispatch(modalToggle("addWorker")); setModalAdd(true); }} > +

добавить участника

Участвую arrow
Мои arrow

Вернуться на проекты

arrow
{Boolean(projectBoard?.columns) && Boolean(projectBoard.columns.length) && projectBoard.columns.map((column) => { return (
dragOverHandler(e)} onDragEnter={(e) => dragEnterHandler(column.id)} onDrop={(e) => dragDropHandler(e, column.id)} className={`tasks__board ${ column.tasks.length >= 3 ? "tasks__board__more" : "" } ${ wrapperHover[column.id] ? "tasks__board__hover" : "" }`} >
{/**/} {column.title}
selectedTabTask(column.id)} > + ...
{column.tasks.map((task, index) => { if (index > 2) { if (!column.open) { return; } } return (
dragStartHandler(e, task, column.id) } onDragEnd={(e) => dragEndHandler(e)} onClick={(e) => openTicket(e, task)} >

{task.title}

{task.description}

commentsImg {task.comments} коментариев
filesImg {task.files} файлов
{/*
*/} {/* avatar*/} {/* avatar*/} {/*
*/}
); })} {column.tasks.length > 3 && ( toggleMoreTasks(column.id)} > {column.open ? "-" : "+"} )}
); })}
); };