tracker tasks

This commit is contained in:
Николай Полтщук 2023-08-30 17:02:50 +03:00
parent 5fa069d84d
commit 86d29475aa
4 changed files with 37 additions and 27 deletions

View File

@ -21,10 +21,10 @@ import {
urlForLocal,
} from "@utils/helper";
import { useNotification } from "@hooks/useNotification";
import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader";

View File

@ -621,7 +621,7 @@ export const ProjectTracker = () => {
</div>
</div>
)}
<div className='tasksContainer'>
<div className="tasksContainer">
{column.tasks.map((task) => {
return (
<div
@ -678,20 +678,26 @@ export const ProjectTracker = () => {
/>
)}
</div>
{task.dead_line &&
<div className="tasks__board__item__deadLine">
<p>Срок исполнения:</p>
<span>
{getCorrectDate(task.dead_line)}
</span>
</div>
}
{task.dead_line && (
<div className="tasks__board__item__deadLine">
<p>Срок исполнения:</p>
<span>
{getCorrectDate(task.dead_line)}
</span>
</div>
)}
<div className="tasks__board__item__info">
<div className="tasks__board__item__info__more">
<img src={commentsBoard} alt="commentsImg" />
<img
src={commentsBoard}
alt="commentsImg"
/>
<span>
{task.comment_count}{" "}
{caseOfNum(task.comment_count, "comments")}
{caseOfNum(
task.comment_count,
"comments"
)}
</span>
</div>
<div className="tasks__board__item__info__more">

View File

@ -9,7 +9,7 @@ import {
setToggleTab,
} from "@redux/projectsTrackerSlice";
import {caseOfNum, urlForLocal} from "@utils/helper";
import { caseOfNum, urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
@ -296,10 +296,9 @@ export const Tracker = () => {
<div className="archive__title">
<h3>Архив задач:</h3>
<p>
{
`${filterCompleteTasks.length}
${caseOfNum(filterCompleteTasks.length, "tasks")}`
}</p>
{`${filterCompleteTasks.length}
${caseOfNum(filterCompleteTasks.length, "tasks")}`}
</p>
<div className="archive__tasks__search">
<img src={search} alt="search" />
<input
@ -358,9 +357,14 @@ export const Tracker = () => {
<div className="archive__title">
<h3>Архив проектов:</h3>
<p>
{
`${projects.filter((project) => project.status === 10).length}
${caseOfNum(projects.filter((project) => project.status === 10).length, "projects")}`}
{`${
projects.filter((project) => project.status === 10).length
}
${caseOfNum(
projects.filter((project) => project.status === 10)
.length,
"projects"
)}`}
</p>
</div>
<div className="archive__tasksWrapper">

View File

@ -70,12 +70,12 @@ export function caseOfNum(number, type) {
files: ["файл", "файла", "файлов"],
persons: ["участник", "участника", "участников"],
tasks: ["задача", "задачи", "задач"],
projects: ["проект", "проекта", "проектов"]
}
projects: ["проект", "проекта", "проектов"],
};
const cases = [2, 0, 1, 1, 1, 2];
return allTypes[type][
number % 100 > 4 && number % 100 < 20
? 2
: cases[number % 10 < 5 ? number % 10 : 5]
];
number % 100 > 4 && number % 100 < 20
? 2
: cases[number % 10 < 5 ? number % 10 : 5]
];
}