diff --git a/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx b/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx index 5e8984c9..8d066220 100644 --- a/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx +++ b/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx @@ -1,37 +1,36 @@ import React from "react"; -import ReactPaginate from "react-paginate"; -import AllMyTasksItem from "@components/Common/AllMyTasksItem/AllMyTasksItem"; +import { getCorrectDate } from "@components/Calendar/calendarHelper"; +import ArchiveTasksItem from "@components/Common/AllMyTasksItem/ArchiveTasksItem"; -const ArchiveTableTracker = ({ filterCompleteTasks, projects, loader }) => { +import "./archiveTableTracker.scss"; + +const ArchiveTableTracker = ({ filterCompleteTasks, loader }) => { return ( - <> - - - - - - - - - - - {!loader && ( - <> - {Boolean(filterCompleteTasks.length) ? ( - filterCompleteTasks.map((task, index) => { - ; - }) - ) : ( -
-

В данном месяце у вас не было задач

-
- )} - - )} -
-
ЗадачаПотраченное времяДата окончания
- + + + + + + + + + + {!loader && ( + <> + {Boolean(filterCompleteTasks.length) ? ( + filterCompleteTasks.map((task, index) => { + return ; + }) + ) : ( +
+

В данном месяце у вас не было задач

+
+ )} + + )} +
+
ЗадачаПотраченное времяДата окончания
); }; diff --git a/src/components/Common/AllMyTasksItem/AllMyTasksItem.jsx b/src/components/Common/AllMyTasksItem/AllMyTasksItem.jsx deleted file mode 100644 index 3d0cc90d..00000000 --- a/src/components/Common/AllMyTasksItem/AllMyTasksItem.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from "react"; - -import "./allMyTasksItem.scss"; - -const AllMyTasksItem = ({ task, projects, currentItems }) => { - function toggleDescTask(e) { - e.target.closest("img").classList.toggle("open-desc-item"); - e.target - .closest("td") - ?.querySelector(".taskList__table__name-project") - .classList.toggle("hide-desc"); - } - - return ( - - -
-

- {task.title}#{currentItems} -

- -
{ - toggleDescTask(e); - }} - > - # -
-
-
-

Проект:

-

- {projects.map((project) => { - if (project.id == task.project_id) { - return project.name; - } - })} -

-
- - -
- {task.status == 1 ? "Active" : "Close"} -
- - - {task.timers.map((item) => { - let time = new Date(item.deltaSeconds * 1000) - .toISOString() - .slice(11, 19); - return `${time}`; - })} - - {new Date(task.created_at).toLocaleDateString()} - {new Date(task.dead_line).toLocaleDateString()} - - ); -}; - -export default AllMyTasksItem; diff --git a/src/components/Common/ArchiveTasksItem/ArchiveTasksItem.jsx b/src/components/Common/ArchiveTasksItem/ArchiveTasksItem.jsx new file mode 100644 index 00000000..432fe1a2 --- /dev/null +++ b/src/components/Common/ArchiveTasksItem/ArchiveTasksItem.jsx @@ -0,0 +1,40 @@ +import React from "react"; + +import { getCorrectDate } from "@components/Calendar/calendarHelper"; + +import "./archiveTasksItem.scss"; + +const ArchiveTasksItem = ({ task, index }) => { + return ( + + +

{task.title}

+

+ + +

+ {task.timers.length == 0 + ? "-" + : task.timers.map((item) => { + let time = new Date(item.deltaSeconds * 1000) + .toISOString() + .slice(11, 19); + return `${time}`; + })} +

+ + +
+

{getCorrectDate(task.updated_at)}

+
+ + + ); +}; + +export default ArchiveTasksItem; diff --git a/src/components/Common/AllMyTasksItem/allMyTasksItem.scss b/src/components/Common/ArchiveTasksItem/archiveTasksItem.scss similarity index 100% rename from src/components/Common/AllMyTasksItem/allMyTasksItem.scss rename to src/components/Common/ArchiveTasksItem/archiveTasksItem.scss diff --git a/src/components/Common/PaginatedItems/PaginatedItems.jsx b/src/components/Common/TrackerArchivePaginated/TrackerArchivePaginated.jsx similarity index 81% rename from src/components/Common/PaginatedItems/PaginatedItems.jsx rename to src/components/Common/TrackerArchivePaginated/TrackerArchivePaginated.jsx index e2986ddc..1c961b83 100644 --- a/src/components/Common/PaginatedItems/PaginatedItems.jsx +++ b/src/components/Common/TrackerArchivePaginated/TrackerArchivePaginated.jsx @@ -1,6 +1,11 @@ import React from "react"; +import { useState } from "react"; +import { useEffect } from "react"; +import ReactPaginate from "react-paginate"; -const PaginatedItems = ({ itemsPerPage, items }) => { +import ArchiveTableTracker from "@components/ArchiveTableTracker/ArchiveTableTracker"; + +const TrackerArchivePaginated = ({ itemsPerPage, items, projects, loader }) => { const [currentItems, setCurrentItems] = useState(null); const [pageCount, setPageCount] = useState(0); const [itemOffset, setItemOffset] = useState(0); @@ -22,7 +27,6 @@ const PaginatedItems = ({ itemsPerPage, items }) => { return ( <> - {/* */} { ); }; -export default PaginatedItems; +export default TrackerArchivePaginated; diff --git a/src/components/Common/PaginatedItems/paginatedItems.scss b/src/components/Common/TrackerArchivePaginated/trackerArchivePaginated.scss similarity index 100% rename from src/components/Common/PaginatedItems/paginatedItems.scss rename to src/components/Common/TrackerArchivePaginated/trackerArchivePaginated.scss diff --git a/src/pages/Tracker/Tracker.jsx b/src/pages/Tracker/Tracker.jsx index 05687186..a742dab8 100644 --- a/src/pages/Tracker/Tracker.jsx +++ b/src/pages/Tracker/Tracker.jsx @@ -18,6 +18,7 @@ import { getCorrectDate } from "@components/Calendar/calendarHelper"; import BaseButton from "@components/Common/BaseButton/BaseButton"; import { Footer } from "@components/Common/Footer/Footer"; import { Loader } from "@components/Common/Loader/Loader"; +import TrackerArchivePaginated from "@components/Common/TrackerArchivePaginated/TrackerArchivePaginated"; import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal"; import { Navigation } from "@components/Navigation/Navigation"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; @@ -443,7 +444,6 @@ export const Tracker = () => {