From 5dbf1421f0a31d48659061b616319fd081f16fdf Mon Sep 17 00:00:00 2001 From: Mikola Date: Wed, 28 Feb 2024 14:04:33 +0300 Subject: [PATCH 1/2] statistics --- src/components/features/quiz/quiz.scss | 1 - .../PartnerSettings/partnerSettings.scss | 2 +- src/pages/Statistics/Statistics.jsx | 262 ++++++++++-------- src/pages/Statistics/statistics.scss | 40 ++- 4 files changed, 181 insertions(+), 124 deletions(-) diff --git a/src/components/features/quiz/quiz.scss b/src/components/features/quiz/quiz.scss index bceb02b9..c4bfd0cd 100644 --- a/src/components/features/quiz/quiz.scss +++ b/src/components/features/quiz/quiz.scss @@ -566,7 +566,6 @@ $maxWidthContainer: 1123; align-items: center; width: 100%; height: 100%; - flex-wrap: wrap; @media (max-width: 600px) { display: block; } diff --git a/src/pages/PartnerSettings/partnerSettings.scss b/src/pages/PartnerSettings/partnerSettings.scss index f77fc8b5..cee05a82 100644 --- a/src/pages/PartnerSettings/partnerSettings.scss +++ b/src/pages/PartnerSettings/partnerSettings.scss @@ -225,7 +225,7 @@ &__report, &__login { - width: 60%; + width: 100%; } &__report { diff --git a/src/pages/Statistics/Statistics.jsx b/src/pages/Statistics/Statistics.jsx index fce85360..48d5a1b7 100644 --- a/src/pages/Statistics/Statistics.jsx +++ b/src/pages/Statistics/Statistics.jsx @@ -1,6 +1,6 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import { useDispatch } from "react-redux"; -import { Link } from "react-router-dom"; +import { Link, useParams } from "react-router-dom"; import { setToggleTab } from "@redux/projectsTrackerSlice"; @@ -10,6 +10,10 @@ import { Footer } from "@components/Common/Footer/Footer"; 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"; @@ -23,6 +27,22 @@ import "./statistics.scss"; const Statistics = () => { const dispatch = useDispatch(); + const params = useParams(); + + 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) + }); + apiRequest(`/project/statistic?project_id=${params.id}`).then((res) => { + setProjectStatistic(res) + setLoader(false) + }); + }, []) const teams = [ { @@ -72,135 +92,139 @@ const Statistics = () => { />

Управление проектами с трекером

-
-
- toggleTabs(1)} - > - img -

Проекты

- - toggleTabs(2)} - > - img -

Все мои задачи

- - toggleTabs(3)} - > - img -

Архив

- -
-
-
-
-
-

Статистика проекта

- # - copyProjectLink("62")} - > + {loader ? + : +
+
+ toggleTabs(1)} + > + img +

Проекты

+ + toggleTabs(2)} + > + img +

Все мои задачи

+ + toggleTabs(3)} + > + img +

Архив

+ +
+
+
+
+
+

Статистика проекта

+ # + copyProjectLink("62")} + > ссылка на проект -
- -
- # - - - К списку проектов - -
-
-
-
-

Проект:

-

{"Разработка трекера"}

-
-
-
-
- Создатель проекта: -
-

{"Василий Тарасов"}

{" "} - # -
-
-
-
-

Открытые задачи

- {4} -
-
-

Задач в работе

- {5} -
-
-

Закрыто задач

- {434} -
-
-
-
- Участники проекта: -
-
-

Имя

-

Почта

-

Роль

-

Статус

-
-
- {teams.map((item) => { - return ( - <> -
-
- # -

{item.name}

-
-
- # -

{item.email}

-
-

{item.role}

- {/* */} +
+ # - - {item.status ? "Активно" : "Не активно"} + + К списку проектов + +
+
+
+
+

Проект:

+

{projectInfo?.name}

+
+
+
+
+ Создатель проекта: +
+

{projectInfo?.owner_info?.fio}

{" "} + # +
+
+
+
+

Открытые задачи

+ {projectStatistic?.open_tasks_count} +
+
+

Задач в работе

+ {projectStatistic?.task_on_work_count} +
+
+

Закрыто задач

+ {projectStatistic?.closed_task_count} +
+
+
+
+
+ Участники проекта: +
+
+

Имя

+

Почта

+

Роль

+

Статус

+
+
+ {projectStatistic?.participants.map((person, index) => { + return ( + <> +
+
+ avatar +

{person.username}

+
+
+ # +

{person.email}

+
+ +

{person.role ? person.role : '-'}

+ {/* */} + + + {person.status ? "Активно" : "Не активно"} -
- - ); - })} +
+ + ); + })} +
+
+
+ + +

Добавить участника

-
-
- + -

Добавить участника

-
+ }
diff --git a/src/pages/Statistics/statistics.scss b/src/pages/Statistics/statistics.scss index fa9e465b..adfaac12 100644 --- a/src/pages/Statistics/statistics.scss +++ b/src/pages/Statistics/statistics.scss @@ -144,6 +144,11 @@ line-height: 32px; margin-right: 19px; } + + img { + max-width: 36px; + max-height: 36px; + } } } @@ -240,7 +245,7 @@ &__head { display: flex; justify-content: space-between; - margin-right: 123px; + margin-right: 55px; p { color: #5b6871; @@ -255,6 +260,30 @@ @media (max-width: 650px) { display: none; } + + .head { + &__name { + max-width: 270px; + width: 100%; + } + + &__email { + max-width: 270px; + width: 100%; + } + + &__role { + max-width: 168px; + width: 100%; + text-align: center; + } + + &__status { + text-align: center; + max-width: 152px; + width: 100%; + } + } } &__item { @@ -270,14 +299,18 @@ &-name { display: flex; align-items: center; - width: 202px; + max-width: 270px; + width: 100%; img { margin-right: 10px; + max-width: 36px; + max-height: 36px; } } &-email { - width: 235px; + max-width: 270px; + width: 100%; align-items: center; display: flex; @@ -292,6 +325,7 @@ &-type { width: 168px; + text-align: center; } @media (max-width: 850px) { From c972df0656717d4d1ea0c2f07a11b8382d7a3f3c Mon Sep 17 00:00:00 2001 From: Mikola Date: Wed, 28 Feb 2024 14:04:57 +0300 Subject: [PATCH 2/2] statistics --- src/pages/Statistics/Statistics.jsx | 71 +++++++++++++++++++---------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/src/pages/Statistics/Statistics.jsx b/src/pages/Statistics/Statistics.jsx index 48d5a1b7..1cb7f6bc 100644 --- a/src/pages/Statistics/Statistics.jsx +++ b/src/pages/Statistics/Statistics.jsx @@ -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 = () => { />

Управление проектами с трекером

- {loader ? - : + {loader ? ( + + ) : (
{ className="return-text" onClick={() => copyProjectLink("62")} > - ссылка на проект - + ссылка на проект +
@@ -154,21 +154,34 @@ const Statistics = () => { Создатель проекта:

{projectInfo?.owner_info?.fio}

{" "} - # + #

Открытые задачи

- {projectStatistic?.open_tasks_count} + + {projectStatistic?.open_tasks_count} +

Задач в работе

- {projectStatistic?.task_on_work_count} + + {projectStatistic?.task_on_work_count} +

Закрыто задач

- {projectStatistic?.closed_task_count} + + {projectStatistic?.closed_task_count} +
@@ -189,7 +202,13 @@ const Statistics = () => {
avatar + src={ + person.avatar + ? urlForLocal(person.avatar) + : mockAvatar + } + alt="avatar" + />

{person.username}

@@ -197,7 +216,9 @@ const Statistics = () => {

{person.email}

-

{person.role ? person.role : '-'}

+

+ {person.role ? person.role : "-"} +

{/* */} { : "status status-none" } > - {person.status ? "Активно" : "Не активно"} - + {person.status ? "Активно" : "Не активно"} +
); @@ -224,7 +245,7 @@ const Statistics = () => {
- } + )}