full screen ticket fix

This commit is contained in:
Victor Batischev 2024-01-30 20:16:21 +03:00
parent a32533fdea
commit 43cd44f0a9

View File

@ -7,13 +7,7 @@ import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate, useParams } from "react-router-dom"; import { Link, useNavigate, useParams } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice"; import { getProfileInfo } from "@redux/outstaffingSlice";
import { import { getBoarderLoader, setToggleTab } from "@redux/projectsTrackerSlice";
deletePersonOnProject,
getBoarderLoader,
modalToggle,
setProjectBoardFetch,
setToggleTab
} from "@redux/projectsTrackerSlice";
import { import {
backendImg, backendImg,
@ -32,7 +26,6 @@ import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import FileTracker from "@components/FileTracker/FileTracker"; import FileTracker from "@components/FileTracker/FileTracker";
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal"; import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
@ -60,7 +53,6 @@ import "./ticketFullScreen.scss";
registerLocale("ru", ru); registerLocale("ru", ru);
export const TicketFullScreen = () => { export const TicketFullScreen = () => {
const [modalAddWorker, setModalAddWorker] = useState(false);
const ticketId = useParams(); const ticketId = useParams();
const dispatch = useDispatch(); const dispatch = useDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
@ -71,7 +63,6 @@ export const TicketFullScreen = () => {
const [inputsValue, setInputsValue] = useState({}); const [inputsValue, setInputsValue] = useState({});
const [loader, setLoader] = useState(true); const [loader, setLoader] = useState(true);
const [comments, setComments] = useState([]); const [comments, setComments] = useState([]);
const [personListOpen, setPersonListOpen] = useState(false);
const [timerStart, setTimerStart] = useState(false); const [timerStart, setTimerStart] = useState(false);
const [timerInfo, setTimerInfo] = useState({}); const [timerInfo, setTimerInfo] = useState({});
const [currentTimerCount, setCurrentTimerCount] = useState({ const [currentTimerCount, setCurrentTimerCount] = useState({
@ -292,18 +283,6 @@ export const TicketFullScreen = () => {
}); });
} }
function deletePerson(userId) {
apiRequest("/project/del-user", {
method: "DELETE",
data: {
project_id: projectInfo.id,
user_id: userId
}
}).then(() => {
dispatch(deletePersonOnProject(userId));
});
}
function commentDelete(comment) { function commentDelete(comment) {
setComments((prevValue) => setComments((prevValue) =>
prevValue.filter((item) => item.id !== comment.id) prevValue.filter((item) => item.id !== comment.id)
@ -616,18 +595,6 @@ export const TicketFullScreen = () => {
) { ) {
setSelectTagsOpen(false); setSelectTagsOpen(false);
} }
if (
event &&
!path.find(
(div) =>
div.classList &&
(div.classList.contains("addPerson") ||
div.classList.contains("persons__list"))
)
) {
setPersonListOpen(false);
}
}; };
return ( return (
@ -680,98 +647,6 @@ export const TicketFullScreen = () => {
<div className="tasks__head"> <div className="tasks__head">
<div className="tasks__head__wrapper tasks__head__wrapper__fullScreen"> <div className="tasks__head__wrapper tasks__head__wrapper__fullScreen">
<h5>{projectInfo.name}</h5> <h5>{projectInfo.name}</h5>
<TrackerModal
active={modalAddWorker}
setActive={setModalAddWorker}
/>
<div className="tasks__head__persons">
<div className="projectPersons">
{projectInfo.projectUsers?.length &&
projectInfo.projectUsers.slice(0, 3).map((person) => {
return (
<img
key={person.user_id}
src={
person.user?.avatar
? urlForLocal(person.user.avatar)
: avatarMok
}
alt="avatar"
/>
);
})}
</div>
{projectInfo.projectUsers?.length > 3 && (
<span className="countPersons">+1</span>
)}
<span
className="addPerson"
onClick={() => {
setPersonListOpen(true);
}}
>
+
</span>
<p>добавить участника</p>
{personListOpen && (
<div className="persons__list">
<img
className="persons__list__close"
src={close}
alt="close"
onClick={() => setPersonListOpen(false)}
/>
<div className="persons__list__count">
<span>{projectInfo.projectUsers?.length}</span>
участник
</div>
<div className="persons__list__info">
<span>В проекте - </span>
<p>{projectInfo.name}</p>
</div>
<div className="persons__list__items">
{projectInfo.projectUsers?.map((person) => {
return (
<div
className="persons__list__item"
key={person.user_id}
>
<img
className="avatar"
src={
person.user?.avatar
? urlForLocal(person.user.avatar)
: avatarMok
}
alt="avatar"
/>
<span>{person.user.fio}</span>
<img
className="delete"
src={close}
alt="delete"
onClick={() => deletePerson(person.user_id)}
/>
</div>
);
})}
</div>
<div
className="persons__list__add"
onClick={() => {
dispatch(modalToggle("addWorker"));
setModalAddWorker(true);
setPersonListOpen(false);
}}
>
<span className="addPerson">+</span>
<p>Добавить участников</p>
</div>
</div>
)}
</div>
<Link <Link
to={`/tracker/project/${taskInfo.project_id}`} to={`/tracker/project/${taskInfo.project_id}`}
className="link" className="link"
@ -800,7 +675,6 @@ export const TicketFullScreen = () => {
/> />
) : ( ) : (
<h5 className="fullName nameFullScreen"> <h5 className="fullName nameFullScreen">
<span>Название задачи:</span>
{inputsValue.title} {inputsValue.title}
</h5> </h5>
)} )}
@ -833,12 +707,7 @@ export const TicketFullScreen = () => {
/> />
) : ( ) : (
<div className="ticket__description"> <div className="ticket__description">
<span> <div
Описание
<br />
задачи:{" "}
</span>
<p
className="fullDescription fullScreenDescription" className="fullDescription fullScreenDescription"
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: inputsValue.description __html: inputsValue.description
@ -884,18 +753,6 @@ export const TicketFullScreen = () => {
</div> </div>
)} )}
<div className="content__communication"> <div className="content__communication">
{/*<p className="tasks">*/}
{/* <BaseButton*/}
{/* onClick={() => {*/}
{/* dispatch(modalToggle("addSubtask"));*/}
{/* setModalAddWorker(true);*/}
{/* }}*/}
{/* styles={"button-green-add"}*/}
{/* >*/}
{/* <img src={plus}></img>*/}
{/* Добавить под задачу*/}
{/* </BaseButton>*/}
{/*</p>*/}
<div className="file"> <div className="file">
<div className="input__wrapper"> <div className="input__wrapper">
<input <input
@ -954,27 +811,30 @@ export const TicketFullScreen = () => {
</div> </div>
<div className="workers fullScreenWorkers"> <div className="workers fullScreenWorkers">
<div className="workers_box task__info"> <div className="workers_box task__info">
<p className="workers__creator"> <div className="workers__creator">
Создатель:<p>&nbsp;{taskInfo.user?.fio}</p> Создатель: <p>&nbsp;{taskInfo.user?.fio}</p>
</p> </div>
{taskInfo.executor ? ( {taskInfo.executor ? (
<div className="executor"> <>
<p>Исполнитель: {taskInfo.executor.fio}</p> <h5>Исполнитель: </h5>
<img <div className="executor">
src={ <p>{taskInfo.executor.fio}</p>
taskInfo.executor?.avatar <img
? urlForLocal(taskInfo.executor.avatar) src={
: avatarMok taskInfo.executor?.avatar
} ? urlForLocal(taskInfo.executor.avatar)
alt="avatar" : avatarMok
/> }
<img alt="avatar"
src={close} />
className="delete" <img
onClick={() => deleteTaskExecutor()} src={close}
/> className="delete"
</div> onClick={() => deleteTaskExecutor()}
/>
</div>
</>
) : ( ) : (
<div className="add-worker moreItems "> <div className="add-worker moreItems ">
<button <button