tracker-tasks

This commit is contained in:
Николай Полтщук 2023-06-29 19:19:13 +03:00
parent e58a576be9
commit d48957746f
4 changed files with 37 additions and 15 deletions

View File

@ -87,9 +87,12 @@ export const TrackerTaskComment = ({
<div className="comments__list__item__fio">
<img
src={
comment.user?.avatar ? urlForLocal(comment.user.avatar) : avatarMok
comment.user?.avatar
? urlForLocal(comment.user.avatar)
: avatarMok
}
alt="avatar" />
alt="avatar"
/>
<p>{comment.user.fio}</p>
</div>
<div className="comments__list__item__date">

View File

@ -20,6 +20,7 @@ import {
} from "@redux/projectsTrackerSlice";
import { urlForLocal } from "@utils/helper";
import { caseOfNum } from "@utils/helper";
import { apiRequest } from "@api/request";
@ -43,7 +44,6 @@ import project from "assets/icons/trackerProject.svg";
import tasks from "assets/icons/trackerTasks.svg";
import accept from "assets/images/accept.png";
import avatarMok from "assets/images/avatarMok.png";
import { caseOfNum } from "@utils/helper";
export const ProjectTracker = () => {
const dispatch = useDispatch();
@ -563,11 +563,17 @@ export const ProjectTracker = () => {
<div className="tasks__board__item__info">
<div className="tasks__board__item__info__more">
<img src={commentsBoard} alt="commentsImg" />
<span>{task.comment_count} {caseOfNum(task.comment_count, 'comments')}</span>
<span>
{task.comment_count}{" "}
{caseOfNum(task.comment_count, "comments")}
</span>
</div>
<div className="tasks__board__item__info__more">
<img src={filesBoard} alt="filesImg" />
<span>{task.files ? task.files : 0} {caseOfNum(0, 'files')}</span>
<span>
{task.files ? task.files : 0}{" "}
{caseOfNum(0, "files")}
</span>
</div>
</div>
</div>

View File

@ -27,10 +27,10 @@ import archive from "assets/icons/archiveTracker.svg";
import search from "assets/icons/serchIcon.png";
import project from "assets/icons/trackerProject.svg";
import tasks from "assets/icons/trackerTasks.svg";
import avatarMok from "assets/images/avatarMok.png";
import noProjects from "assets/images/noProjects.png";
import "./tracker.scss";
import avatarMok from "assets/images/avatarMok.png";
export const Tracker = () => {
const dispatch = useDispatch();
@ -254,12 +254,18 @@ export const Tracker = () => {
<div className="task" key={task.id}>
<div className="task__info">
<h5>{task.title}</h5>
<p dangerouslySetInnerHTML={{ __html: task.description }} />
<p
dangerouslySetInnerHTML={{
__html: task.description,
}}
/>
</div>
<div className="task__person">
<img
src={
task.user?.avatar ? urlForLocal(task.user.avatar) : avatarMok
task.user?.avatar
? urlForLocal(task.user.avatar)
: avatarMok
}
alt="avatar"
/>
@ -304,12 +310,19 @@ export const Tracker = () => {
<div className="archive__completeTask" key={index}>
<div className="archive__completeTask__description">
<p>{task.title}</p>
<p className="date" dangerouslySetInnerHTML={{ __html: task.description }} />
<p
className="date"
dangerouslySetInnerHTML={{
__html: task.description,
}}
/>
</div>
<div className="archive__completeTask__info">
<img
src={
task.user?.avatar ? urlForLocal(task.user.avatar) : avatarMok
task.user?.avatar
? urlForLocal(task.user.avatar)
: avatarMok
}
alt="avatar"
/>

View File

@ -64,16 +64,16 @@ export function getCorrectRequestDate(date) {
export function caseOfNum(number, type) {
const comments = ["коментарий", "комментария", " коментариев"];
const files = ["файлов", "файла", "файлов"]
const files = ["файлов", "файла", "файлов"];
const cases = [2, 0, 1, 1, 1, 2];
if (type === 'comments') {
if (type === "comments") {
return comments[
number % 100 > 4 && number % 100 < 20
? 2
: cases[number % 10 < 5 ? number % 10 : 5]
];
}
if (type === 'files') {
if (type === "files") {
return files[
number % 100 > 4 && number % 100 < 20
? 2