diff --git a/apps/app/components/modules/sidebar.tsx b/apps/app/components/modules/sidebar.tsx index 11555e007..9e379642e 100644 --- a/apps/app/components/modules/sidebar.tsx +++ b/apps/app/components/modules/sidebar.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import React, { useEffect, useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; @@ -13,10 +13,15 @@ import { ChartPieIcon, LinkIcon, PlusIcon, + Squares2X2Icon, TrashIcon, } from "@heroicons/react/24/outline"; // progress-bar import { CircularProgressbar } from "react-circular-progressbar"; + +import { Popover, Transition } from "@headlessui/react"; +import DatePicker from "react-datepicker"; + // services import modulesService from "services/modules.service"; // hooks @@ -27,16 +32,15 @@ import { ModuleLinkModal, SidebarLeadSelect, SidebarMembersSelect, - SidebarStatusSelect, } from "components/modules"; import "react-circular-progressbar/dist/styles.css"; // components import { SidebarProgressStats } from "components/core"; // ui -import { CustomDatePicker, Loader } from "components/ui"; +import { CustomSelect, Loader } from "components/ui"; // helpers -import { timeAgo } from "helpers/date-time.helper"; +import { renderShortNumericDateFormat, timeAgo } from "helpers/date-time.helper"; import { copyTextToClipboard } from "helpers/string.helper"; import { groupBy } from "helpers/array.helper"; // types @@ -44,6 +48,8 @@ import { IIssue, IModule, ModuleIssueResponse } from "types"; // fetch-keys import { MODULE_DETAILS } from "constants/fetch-keys"; import ProgressChart from "components/core/sidebar/progress-chart"; +// constant +import { MODULE_STATUS } from "constants/module"; const defaultValues: Partial = { lead: "", @@ -63,6 +69,8 @@ type Props = { export const ModuleDetailsSidebar: React.FC = ({ issues, module, isOpen, moduleIssues }) => { const [moduleDeleteModal, setModuleDeleteModal] = useState(false); const [moduleLinkModal, setModuleLinkModal] = useState(false); + const [startDateRange, setStartDateRange] = useState(new Date()); + const [endDateRange, setEndDateRange] = useState(null); const router = useRouter(); const { workspaceSlug, projectId, moduleId } = router.query; @@ -134,6 +142,91 @@ export const ModuleDetailsSidebar: React.FC = ({ issues, module, isOpen, > {module ? ( <> +
+
+ ( + + + {watch("status")} + + } + value={value} + onChange={(value: any) => { + submitChanges({ status: value }); + }} + > + {MODULE_STATUS.map((option) => ( + + {option.label} + + ))} + + )} + /> +
+ + {({ open }) => ( + <> + + + + {renderShortNumericDateFormat(`${module?.start_date}`) + ? renderShortNumericDateFormat(`${module?.start_date}`) + : "N/A"}{" "} + -{" "} + {renderShortNumericDateFormat(`${module?.target_date}`) + ? renderShortNumericDateFormat(`${module?.target_date}`) + : "N/A"} + + + + + + { + const [start, end] = dates; + submitChanges({ + start_date: start?.toISOString(), + target_date: end?.toISOString(), + }); + if (setStartDateRange) { + setStartDateRange(start); + } + if (setEndDateRange) { + setEndDateRange(end); + } + }} + startDate={startDateRange} + endDate={endDateRange} + selectsRange + inline + /> + + + + )} + +

{module.name}

@@ -196,59 +289,6 @@ export const ModuleDetailsSidebar: React.FC = ({ issues, module, isOpen,
-
-
-
- -

Start date

-
-
- ( - - submitChanges({ - start_date: val, - }) - } - /> - )} - /> -
-
-
-
- -

End date

-
-
- ( - - submitChanges({ - target_date: val, - }) - } - /> - )} - /> -
-
-
-
- -

Links