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(2))} >Все мои задачи
dispatch(setToggleTab(3))} >Архив
добавить колонку
добавить участника
Вернуться на проекты
{task.title}
{task.description}