diff --git a/apps/app/components/core/list-view/single-list.tsx b/apps/app/components/core/list-view/single-list.tsx index 4b07fb330..0669f53f5 100644 --- a/apps/app/components/core/list-view/single-list.tsx +++ b/apps/app/components/core/list-view/single-list.tsx @@ -100,7 +100,7 @@ export const SingleList: React.FC = ({ } - optionsPosition="left" + optionsPosition="right" noBorder > Create new diff --git a/apps/app/components/cycles/single-cycle-card.tsx b/apps/app/components/cycles/single-cycle-card.tsx index 607c0cc04..794a98e25 100644 --- a/apps/app/components/cycles/single-cycle-card.tsx +++ b/apps/app/components/cycles/single-cycle-card.tsx @@ -62,6 +62,7 @@ export const SingleCycleCard: React.FC = (props) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; + const { setToastAlert } = useToast(); const { data: cycleIssues } = useSWR( @@ -80,7 +81,7 @@ export const SingleCycleCard: React.FC = (props) => { started: [], cancelled: [], completed: [], - ...groupBy(cycleIssues ?? [], "issue_detail.state_detail.group"), + ...groupBy(cycleIssues ?? [], "state_detail.group"), }; const handleAddToFavorites = () => { @@ -324,7 +325,7 @@ export const SingleCycleCard: React.FC = (props) => { }`} >
- Progress + Progress diff --git a/apps/app/components/modules/single-module-card.tsx b/apps/app/components/modules/single-module-card.tsx index 251debff9..a839eafe2 100644 --- a/apps/app/components/modules/single-module-card.tsx +++ b/apps/app/components/modules/single-module-card.tsx @@ -4,9 +4,11 @@ import Link from "next/link"; import { useRouter } from "next/router"; import Image from "next/image"; -import { mutate } from "swr"; +import useSWR, { mutate } from "swr"; -// toast +// services +import modulesService from "services/modules.service"; +// hooks import useToast from "hooks/use-toast"; // components import { DeleteModuleModal } from "components/modules"; @@ -24,17 +26,12 @@ import { UserGroupIcon, } from "@heroicons/react/24/outline"; // helpers +import { copyTextToClipboard, truncateText } from "helpers/string.helper"; import { renderShortDateWithYearFormat } from "helpers/date-time.helper"; -// services -import modulesService from "services/modules.service"; // types import { IModule } from "types"; // fetch-key -import { MODULE_LIST } from "constants/fetch-keys"; -// helpers -import { copyTextToClipboard, truncateText } from "helpers/string.helper"; -// constants -import { MODULE_STATUS } from "constants/module"; +import { MODULE_ISSUES, MODULE_LIST } from "constants/fetch-keys"; type Props = { module: IModule; @@ -46,8 +43,21 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule }) const router = useRouter(); const { workspaceSlug, projectId } = router.query; + const { setToastAlert } = useToast(); + const { data: moduleIssues } = useSWR( + workspaceSlug && projectId && module.id ? MODULE_ISSUES(module.id as string) : null, + workspaceSlug && projectId && module.id + ? () => + modulesService.getModuleIssues(workspaceSlug as string, projectId as string, module.id) + : null + ); + + const completedIssues = (moduleIssues ?? []).filter( + (i) => i.state_detail.group === "completed" || i.state_detail.group === "cancelled" + ).length; + const handleDeleteModule = () => { if (!module) return; @@ -143,25 +153,58 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule }) data={module} />
-
s.value === module.status)?.color ?? "#6b7280", - }} - > -
+
+
- - - -

- {truncateText(module.name, 75)} -

-
- -
-
-
+
+ + + +

+ {truncateText(module.name, 75)} +

+
+ +
+ +
+
+ {module?.status?.replace("-", " ")} +
+ {module.is_favorite ? ( + + ) : ( + + )} + + + + + + Edit Module + + + + + + Delete Module + + + + + + Copy Module Link + + + +
+
+
+
Start: {renderShortDateWithYearFormat(startDate)} @@ -171,11 +214,9 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule }) End: {renderShortDateWithYearFormat(endDate)}
-
-
- - Lead: + + Lead:
{module.lead_detail ? (
@@ -197,8 +238,8 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule })
- - Members: + + Members:
{module.members && module.members.length > 0 ? ( @@ -218,42 +259,14 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule })
-
-
- {module?.status?.replace("-", " ")} -
-
- {module.is_favorite ? ( - - ) : ( - - )} - - - - - - Edit Module - - - - - - Delete Module - - - - - - Copy Module Link - - - -
+
+
+ Progress{" "} +
+