trackerTask #22

Merged
nik.polishuk merged 2 commits from trackerTask into main 2024-02-28 14:06:05 +03:00
Showing only changes of commit c972df0656 - Show all commits

View File

@ -5,15 +5,15 @@ import { Link, useParams } from "react-router-dom";
import { setToggleTab } from "@redux/projectsTrackerSlice";
import { copyProjectLink } from "@utils/helper";
import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader";
import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import { Loader } from "@components/Common/Loader/Loader";
import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import arrow from "assets/icons/arrows/arrowCalendar.png";
import emailImg from "assets/icons/emailStatistics.svg";
@ -29,20 +29,19 @@ const Statistics = () => {
const dispatch = useDispatch();
const params = useParams();
const [projectStatistic, setProjectStatistic] = useState(null)
const [projectInfo, setProjectInfo] = useState(null)
const [loader, setLoader] = useState(true)
const [projectStatistic, setProjectStatistic] = useState(null);
const [projectInfo, setProjectInfo] = useState(null);
const [loader, setLoader] = useState(true);
useEffect(() => {
apiRequest(`/project/get-project?project_id=${params.id}`).then((res) => {
setProjectInfo(res)
setProjectInfo(res);
});
apiRequest(`/project/statistic?project_id=${params.id}`).then((res) => {
setProjectStatistic(res)
setLoader(false)
setProjectStatistic(res);
setLoader(false);
});
}, [])
}, []);
const teams = [
{
@ -92,8 +91,9 @@ const Statistics = () => {
/>
<h2 className="tracker__title">Управление проектами с трекером</h2>
</div>
{loader ? <Loader />
:
{loader ? (
<Loader />
) : (
<div className="tracker__tabs">
<div className="tracker__tabs__head">
<Link
@ -131,8 +131,8 @@ const Statistics = () => {
className="return-text"
onClick={() => copyProjectLink("62")}
>
ссылка на проект
</span>
ссылка на проект
</span>
</div>
<div className="statistics-header__return">
@ -154,21 +154,34 @@ const Statistics = () => {
<span className="return-text">Создатель проекта:</span>
<div>
<p>{projectInfo?.owner_info?.fio}</p>{" "}
<img src={projectInfo?.owner_info?.avatar ? urlForLocal(projectInfo.owner_info.avatar) : mockAvatar} alt="#" />
<img
src={
projectInfo?.owner_info?.avatar
? urlForLocal(projectInfo.owner_info.avatar)
: mockAvatar
}
alt="#"
/>
</div>
</div>
<div className="project-info__tasks">
<div className="task-quantity">
<p>Открытые задачи</p>
<span className="task-quantity_open">{projectStatistic?.open_tasks_count}</span>
<span className="task-quantity_open">
{projectStatistic?.open_tasks_count}
</span>
</div>
<div className="task-quantity">
<p>Задач в работе</p>
<span className="task-quantity_work">{projectStatistic?.task_on_work_count}</span>
<span className="task-quantity_work">
{projectStatistic?.task_on_work_count}
</span>
</div>
<div className="task-quantity">
<p>Закрыто задач</p>
<span className="task-quantity_closed">{projectStatistic?.closed_task_count}</span>
<span className="task-quantity_closed">
{projectStatistic?.closed_task_count}
</span>
</div>
</div>
</div>
@ -189,7 +202,13 @@ const Statistics = () => {
<div className="list-team__item" key={index}>
<div className="person-name">
<img
src={person.avatar ? urlForLocal(person.avatar) : mockAvatar} alt="avatar" />
src={
person.avatar
? urlForLocal(person.avatar)
: mockAvatar
}
alt="avatar"
/>
<p>{person.username}</p>
</div>
<div className="person-email">
@ -197,7 +216,9 @@ const Statistics = () => {
<p>{person.email}</p>
</div>
<p className="person-type">{person.role ? person.role : '-'}</p>
<p className="person-type">
{person.role ? person.role : "-"}
</p>
{/* <span className="status status-active"> */}
<span
@ -207,8 +228,8 @@ const Statistics = () => {
: "status status-none"
}
>
{person.status ? "Активно" : "Не активно"}
</span>
{person.status ? "Активно" : "Не активно"}
</span>
</div>
</>
);
@ -224,7 +245,7 @@ const Statistics = () => {
</div>
</div>
</div>
}
)}
</div>
<Footer />
</div>