This commit is contained in:
Mikola
2023-12-05 14:15:04 +03:00
parent b66537f4a4
commit 9e10088494
32 changed files with 137 additions and 139 deletions

View File

@ -63,7 +63,7 @@ export const AuthBox = ({ title }) => {
localStorage.setItem("role_status", res.status);
localStorage.setItem(
"access_token_expired_at",
res.access_token_expired_at,
res.access_token_expired_at
);
dispatch(auth(true));
dispatch(setUserInfo(res));

View File

@ -89,7 +89,7 @@ const CalendarComponent = ({ onSelect }) => {
<img className={"calendar__icon"} src={calendarIcon} alt="" />
{currentMonthAndDay(day)}
</button>
)),
))
)}
</div>
</div>

View File

@ -17,7 +17,7 @@ export function calendarHelper(value) {
calendar.push(
Array(1)
.fill(0)
.map(() => day.add(1, "day").clone()),
.map(() => day.add(1, "day").clone())
);
}
@ -45,7 +45,7 @@ export function getReports(value) {
export function getCreatedDate(day) {
if (day) {
return `${new Date(day).getFullYear()}-${correctDay(
new Date(day).getMonth() + 1,
new Date(day).getMonth() + 1
)}-${correctDay(new Date(day).getDate())}`;
} else {
const date = new Date();

View File

@ -48,7 +48,7 @@ const Candidate = () => {
useEffect(() => {
apiRequest(`/user/me`, {}).then((el) =>
dispatch(currentCandidate(el.userCard)),
dispatch(currentCandidate(el.userCard))
);
}, [dispatch]);

View File

@ -70,7 +70,7 @@ export const ModalTiсket = ({
const [deadLine, setDeadLine] = useState(task.dead_line);
const [datePickerOpen, setDatePickerOpen] = useState(false);
const [startDate, setStartDate] = useState(
task.dead_line ? new Date(task.dead_line) : new Date(),
task.dead_line ? new Date(task.dead_line) : new Date()
);
const [dropListOpen, setDropListOpen] = useState(false);
const [dropListMembersOpen, setDropListMembersOpen] = useState(false);
@ -190,7 +190,7 @@ export const ModalTiсket = ({
function commentDelete(comment) {
setComments((prevValue) =>
prevValue.filter((item) => item.id !== comment.id),
prevValue.filter((item) => item.id !== comment.id)
);
if (comment.subComments.length) {
// promiseAll
@ -221,7 +221,7 @@ export const ModalTiсket = ({
deleteSubComment.forEach((comment, index) => {
if (comment.id === subComment.parent_id) {
deleteSubComment[index].subComments = comment.subComments.filter(
(item) => item.id !== subComment.id,
(item) => item.id !== subComment.id
);
}
});
@ -328,7 +328,7 @@ export const ModalTiсket = ({
useEffect(() => {
initListeners();
apiRequest(
`/comment/get-by-entity?entity_type=2&entity_id=${task.id}`,
`/comment/get-by-entity?entity_type=2&entity_id=${task.id}`
).then((res) => {
const comments = res.reduce((acc, cur) => {
if (!cur.parent_id) {
@ -362,7 +362,7 @@ export const ModalTiсket = ({
setTimerInfo(time);
}
});
},
}
);
apiRequest(`/file/get-by-entity?entity_type=2&entity_id=${task.id}`).then(
@ -370,15 +370,15 @@ export const ModalTiсket = ({
if (Array.isArray(res)) {
setTaskFiles(res);
}
},
}
);
if (
localStorage.getItem("role_status") !== "18" &&
Boolean(
!correctProjectUsers.find(
(item) => item.user_id === profileInfo.id_user,
),
(item) => item.user_id === profileInfo.id_user
)
)
) {
setCorrectProjectUsers((prevState) => [
@ -400,7 +400,7 @@ export const ModalTiсket = ({
projectMarks.reduce((acc, cur) => {
if (!tagIds.includes(cur.id)) acc.push(cur);
return acc;
}, []),
}, [])
);
}, [taskTags]);
@ -440,7 +440,7 @@ export const ModalTiсket = ({
function deleteFile(file) {
setTaskFiles((prevValue) =>
prevValue.filter((item) => item.id !== file.id),
prevValue.filter((item) => item.id !== file.id)
);
}
@ -448,7 +448,7 @@ export const ModalTiсket = ({
setTimerId(
setInterval(() => {
run();
}, 1000),
}, 1000)
);
}
@ -485,13 +485,13 @@ export const ModalTiсket = ({
projectUsers.reduce((acc, cur) => {
if (!ids.includes(cur.user_id)) acc.push(cur);
return acc;
}, []),
}, [])
);
}, [members]);
function copyTicketLink() {
navigator.clipboard.writeText(
`https://itguild.info/tracker/task/${task.id}`,
`https://itguild.info/tracker/task/${task.id}`
);
showNotification({
show: true,
@ -558,7 +558,7 @@ export const ModalTiсket = ({
(div) =>
div.classList &&
(div.classList.contains("button-add-worker") ||
div.classList.contains("dropdownList")),
div.classList.contains("dropdownList"))
)
) {
setDropListOpen(false);
@ -571,7 +571,7 @@ export const ModalTiсket = ({
(div) =>
div.classList &&
(div.classList.contains("deadLine") ||
div.classList.contains("react-datepicker-popper")),
div.classList.contains("react-datepicker-popper"))
)
) {
setDatePickerOpen(false);
@ -583,7 +583,7 @@ export const ModalTiсket = ({
(div) =>
div.classList &&
(div.classList.contains("tags") ||
div.classList.contains("tags__dropDown")),
div.classList.contains("tags__dropDown"))
)
) {
setSelectTagsOpen(false);

View File

@ -128,7 +128,7 @@ export const TicketFullScreen = () => {
setDeadLine(taskInfo.dead_line);
setTaskPriority(taskInfo.execution_priority);
setStartDate(
taskInfo.dead_line ? new Date(taskInfo.dead_line) : new Date(),
taskInfo.dead_line ? new Date(taskInfo.dead_line) : new Date()
);
setInputsValue({
title: taskInfo.title,
@ -137,7 +137,7 @@ export const TicketFullScreen = () => {
});
setTaskTags(taskInfo.mark);
apiRequest(
`/comment/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`,
`/comment/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`
).then((res) => {
const comments = res.reduce((acc, cur) => {
if (!cur.parent_id) {
@ -152,14 +152,14 @@ export const TicketFullScreen = () => {
setComments(comments);
});
apiRequest(
`/file/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`,
`/file/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`
).then((res) => {
if (Array.isArray(res)) {
setTaskFiles(res);
}
});
apiRequest(
`/timer/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`,
`/timer/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`
).then((res) => {
let timerSeconds = 0;
res.length &&
@ -181,13 +181,13 @@ export const TicketFullScreen = () => {
});
});
apiRequest(
`/project/get-project?project_id=${taskInfo.project_id}&expand=columns,mark`,
`/project/get-project?project_id=${taskInfo.project_id}&expand=columns,mark`
).then((res) => {
setProjectInfo(res);
setCorrectProjectUsers(res.projectUsers);
});
setLoader(boardLoader);
},
}
);
}, []);
@ -198,7 +198,7 @@ export const TicketFullScreen = () => {
projectInfo.mark.reduce((acc, cur) => {
if (!tagIds.includes(cur.id)) acc.push(cur);
return acc;
}, []),
}, [])
);
}
}, [taskTags, projectInfo]);
@ -306,7 +306,7 @@ export const TicketFullScreen = () => {
function commentDelete(comment) {
setComments((prevValue) =>
prevValue.filter((item) => item.id !== comment.id),
prevValue.filter((item) => item.id !== comment.id)
);
if (comment.subComments.length) {
comment.subComments.forEach((subComment) => {
@ -336,7 +336,7 @@ export const TicketFullScreen = () => {
deleteSubComment.forEach((comment, index) => {
if (comment.id === subComment.parent_id) {
deleteSubComment[index].subComments = comment.subComments.filter(
(item) => item.id !== subComment.id,
(item) => item.id !== subComment.id
);
}
});
@ -349,7 +349,7 @@ export const TicketFullScreen = () => {
function copyTicketLink() {
navigator.clipboard.writeText(
`https://itguild.info/tracker/task/${taskInfo.id}`,
`https://itguild.info/tracker/task/${taskInfo.id}`
);
}
@ -357,7 +357,7 @@ export const TicketFullScreen = () => {
setTimerId(
setInterval(() => {
run();
}, 1000),
}, 1000)
);
}
@ -368,7 +368,7 @@ export const TicketFullScreen = () => {
projectInfo.projectUsers.reduce((acc, cur) => {
if (!ids.includes(cur.user_id)) acc.push(cur);
return acc;
}, []),
}, [])
);
}
}, [taskInfo.taskUsers, projectInfo]);
@ -444,7 +444,7 @@ export const TicketFullScreen = () => {
setTaskInfo((prevState) => ({
...prevState,
taskUsers: taskInfo.taskUsers.filter(
(item) => item.user_id !== person.user_id,
(item) => item.user_id !== person.user_id
),
}));
});
@ -538,7 +538,7 @@ export const TicketFullScreen = () => {
function deleteFile(file) {
setTaskFiles((prevValue) =>
prevValue.filter((item) => item.id !== file.id),
prevValue.filter((item) => item.id !== file.id)
);
}
@ -586,7 +586,7 @@ export const TicketFullScreen = () => {
(div) =>
div.classList &&
(div.classList.contains("button-add-worker") ||
div.classList.contains("dropdownList")),
div.classList.contains("dropdownList"))
)
) {
setDropListOpen(false);
@ -599,7 +599,7 @@ export const TicketFullScreen = () => {
(div) =>
div.classList &&
(div.classList.contains("deadLine") ||
div.classList.contains("react-datepicker-popper")),
div.classList.contains("react-datepicker-popper"))
)
) {
setDatePickerOpen(false);
@ -611,7 +611,7 @@ export const TicketFullScreen = () => {
(div) =>
div.classList &&
(div.classList.contains("tags") ||
div.classList.contains("tags__dropDown")),
div.classList.contains("tags__dropDown"))
)
) {
setSelectTagsOpen(false);
@ -623,7 +623,7 @@ export const TicketFullScreen = () => {
(div) =>
div.classList &&
(div.classList.contains("addPerson") ||
div.classList.contains("persons__list")),
div.classList.contains("persons__list"))
)
) {
setPersonListOpen(false);

View File

@ -71,10 +71,10 @@ export const TrackerModal = ({
const [selectWorkersOpen, setSelectWorkersOpen] = useState(false);
const [selectedWorker, setSelectedWorker] = useState(null);
const [selectColumnPriority, setSelectColumnPriority] = useState(
"Выберите приоритет колонки",
"Выберите приоритет колонки"
);
const [selectedExecutorTask, setSelectedExecutorTask] = useState(
"Выберите исполнителя задачи",
"Выберите исполнителя задачи"
);
const [selectExecutorTaskOpen, setSelectExecutorTaskOpen] = useState(false);
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
@ -316,7 +316,7 @@ export const TrackerModal = ({
persons.reduce((acc, cur) => {
if (!ids.includes(cur.user_id)) acc.push(cur);
return acc;
}, []),
}, [])
);
})
: "";
@ -324,7 +324,7 @@ export const TrackerModal = ({
localStorage.getItem("role_status") !== "18" &&
projectUsers &&
Boolean(
!projectUsers.find((item) => item.user_id === profileInfo.id_user),
!projectUsers.find((item) => item.user_id === profileInfo.id_user)
)
) {
setCorrectProjectUsers([
@ -350,7 +350,7 @@ export const TrackerModal = ({
projectMarks.reduce((acc, cur) => {
if (!tagIds.includes(cur.id)) acc.push(cur);
return acc;
}, []),
}, [])
);
}
}, [taskTags, projectMarks]);
@ -368,7 +368,7 @@ export const TrackerModal = ({
(div) =>
div.classList &&
(div.classList.contains("tags__selected__name") ||
div.classList.contains("tags__dropDown")),
div.classList.contains("tags__dropDown"))
)
) {
setSelectTagsOpen(false);
@ -380,7 +380,7 @@ export const TrackerModal = ({
(div) =>
div.classList &&
(div.classList.contains("select__executor") ||
div.classList.contains("select__executor__dropDown")),
div.classList.contains("select__executor__dropDown"))
)
) {
setSelectExecutorTaskOpen(false);
@ -555,8 +555,8 @@ export const TrackerModal = ({
onClick={() =>
setTaskTags((prevState) =>
prevState.filter(
(prevTag) => prevTag.id !== tag.id,
),
(prevTag) => prevTag.id !== tag.id
)
)
}
/>

View File

@ -15,7 +15,7 @@ export const Navigation = () => {
const profileInfo = useSelector(getProfileInfo);
const [user] = useState(
localStorage.getItem("role_status") === "18" ? "partner" : "developer",
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
);
const [navInfo] = useState({
@ -79,9 +79,9 @@ export const Navigation = () => {
apiRequest(`/user/me`).then((profileInfo) =>
dispatch(
setProfileInfo(
profileInfo.userCard ? profileInfo.userCard : profileInfo,
),
),
profileInfo.userCard ? profileInfo.userCard : profileInfo
)
)
);
}, [dispatch]);

View File

@ -64,8 +64,8 @@ export const ProfileCalendar = () => {
}
apiRequest(
`/reports/reports-by-date?${requestDates}&user_card_id=${localStorage.getItem(
"cardId",
)}`,
"cardId"
)}`
).then((reports) => {
let spendTime = 0;
for (const report of reports) {

View File

@ -86,7 +86,7 @@ export const ProfileCalendarComponent = React.memo(
for (const date of reports) {
if (
`${new Date(day).getFullYear()}-${correctDay(
new Date(day).getMonth() + 1,
new Date(day).getMonth() + 1
)}-${correctDay(new Date(day).getDate())}` === date.created_at
) {
return `before`;
@ -101,7 +101,7 @@ export const ProfileCalendarComponent = React.memo(
for (const date of reports) {
if (
`${new Date(day).getFullYear()}-${correctDay(
new Date(day).getMonth() + 1,
new Date(day).getMonth() + 1
)}-${correctDay(new Date(day).getDate())}` === date.created_at
) {
return "#";
@ -122,15 +122,15 @@ export const ProfileCalendarComponent = React.memo(
const requestDates =
startDate < endDay
? `fromDate=${getCorrectYYMMDD(
startDate._d,
startDate._d
)}&toDate=${getCorrectYYMMDD(endDay._d)}`
: `fromDate=${getCorrectYYMMDD(endDay._d)}&toDate=${getCorrectYYMMDD(
startDate._d,
startDate._d
)}`;
apiRequest(
`/reports/reports-by-date?${requestDates}&user_card_id=${localStorage.getItem(
"cardId",
)}`,
"cardId"
)}`
).then((reports) => {
let spendTime = 0;
for (const report of reports) {
@ -298,7 +298,7 @@ export const ProfileCalendarComponent = React.memo(
{currentMonthAndDay(day)}
</Link>
</button>
)),
))
)}
</div>
</div>
@ -316,15 +316,15 @@ export const ProfileCalendarComponent = React.memo(
? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}`
: `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}`
: activePeriod
? "Выберите диапазон на календаре"
: "Выбрать диапазон"}
? "Выберите диапазон на календаре"
: "Выбрать диапазон"}
</span>
<span>
{totalRangeHours
? `${totalRangeHours} ${hourOfNum(totalRangeHours)}`
: endDate
? "0 часов"
: ""}
? "0 часов"
: ""}
</span>
{endDate && (
<BaseButton
@ -342,5 +342,5 @@ export const ProfileCalendarComponent = React.memo(
{shortReport && <ShortReport />}
</div>
);
},
}
);

View File

@ -15,7 +15,7 @@ export const ProfileHeader = () => {
const dispatch = useDispatch();
const profileInfo = useSelector(getProfileInfo);
const [user] = useState(
localStorage.getItem("role_status") === "18" ? "partner" : "developer",
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
);
const [isLoggingOut, setIsLoggingOut] = useState(false);
@ -30,8 +30,8 @@ export const ProfileHeader = () => {
apiRequest(`/user/me`).then((profileInfo) => {
dispatch(
setProfileInfo(
profileInfo.userCard ? profileInfo.userCard : profileInfo,
),
profileInfo.userCard ? profileInfo.userCard : profileInfo
)
);
});
}, [dispatch]);

View File

@ -46,7 +46,7 @@ export const ProjectTiket = ({ project, index }) => {
event &&
!path.find(
(div) =>
div.classList && div.classList.contains(`project-${project.id}`),
div.classList && div.classList.contains(`project-${project.id}`)
)
) {
setModalSelect(false);
@ -91,7 +91,7 @@ export const ProjectTiket = ({ project, index }) => {
{project.columns.reduce(
(accumulator, currentValue) =>
accumulator + currentValue.tasks.length,
0,
0
)}
</span>
<img src={avatarProject} alt="#" className="project__avatar" />

View File

@ -43,7 +43,7 @@ const ReportForm = () => {
const [isFetching, setIsFetching] = useState(false);
const [reportSuccess, setReportSuccess] = useState("");
const [startDate, setStartDate] = useState(
reportDate ? new Date(reportDate._d) : new Date(),
reportDate ? new Date(reportDate._d) : new Date()
);
const [datePickerOpen, setDatePickerOpen] = useState(false);
@ -73,7 +73,7 @@ const ReportForm = () => {
(div) =>
div.classList &&
(div.classList.contains("report-form__block-img") ||
div.classList.contains("react-datepicker-popper")),
div.classList.contains("react-datepicker-popper"))
)
) {
setDatePickerOpen(false);
@ -210,7 +210,7 @@ const ReportForm = () => {
task: e.target.value,
}
: input;
}),
})
)
}
/>
@ -236,7 +236,7 @@ const ReportForm = () => {
hours_spent: Number(e.target.value),
}
: input;
}),
})
)
}
/>

View File

@ -40,8 +40,8 @@ export const ShortReport = () => {
setTotalHours(0);
apiRequest(
`reports/find-by-date?user_card_id=${localStorage.getItem(
"cardId",
)}&date=${day}`,
"cardId"
)}&date=${day}`
).then((res) => {
let spendTime = 0;
for (const item of res) {

View File

@ -28,7 +28,7 @@ export const TrackerSelectColumn = ({ columns, task, currentColumn }) => {
moveProjectTask({
startWrapperIndex: { index: currentColumn.id, task },
columnId: column.id,
}),
})
);
}}
>

View File

@ -14,7 +14,7 @@ export const Results = () => {
useEffect(() => {
dispatch(fetchResultTest(test.uuid));
apiRequest(
`/user-questionnaire/get-points-number?user_questionnaire_uuid=${test.uuid}`,
`/user-questionnaire/get-points-number?user_questionnaire_uuid=${test.uuid}`
).then((res) => setMaxScore(res.sum_point));
}, [apiRequest, dispatch, test]);

View File

@ -40,7 +40,7 @@ export const TaskQuiz = () => {
(response) => {
dispatch(fetchGetAnswers(response[0].id));
setStripValue(((+index + 1) * 100) / response.length);
},
}
);
}, [dispatch]);