From a63c551e7541b0b35014a2913dec44073d8a5728 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:57:52 +0530 Subject: [PATCH] feat: completed cycle transfer issue validation added (#676) * feat: completed cycle transfer issue validation added * style: transfer issue section * style: issue transfer button --- apps/app/components/core/issues-view.tsx | 20 +------ apps/app/components/cycles/index.ts | 1 + .../app/components/cycles/transfer-issues.tsx | 56 +++++++++++++++++++ 3 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 apps/app/components/cycles/transfer-issues.tsx diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index 364821a2d..5ce930dda 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -18,7 +18,7 @@ import { AllLists, AllBoards, FilterList } from "components/core"; import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues"; import StrictModeDroppable from "components/dnd/StrictModeDroppable"; import { CreateUpdateViewModal } from "components/views"; -import { TransferIssuesModal } from "components/cycles"; +import { TransferIssues, TransferIssuesModal } from "components/cycles"; // ui import { EmptySpace, EmptySpaceItem, PrimaryButton, Spinner } from "components/ui"; import { CalendarView } from "./calendar-view"; @@ -459,23 +459,7 @@ export const IssuesView: React.FC = ({ {groupedByIssues ? ( isNotEmpty ? ( <> - {isCompleted && ( -
-
- - Completed cycles are not editable. -
-
- setTransferIssuesModal(true)} - className="flex items-center gap-3 rounded-lg" - > - - Transfer Issues - -
-
- )} + {isCompleted && setTransferIssuesModal(true)} />} {issueView === "list" ? ( void; +}; + +export const TransferIssues: React.FC = ({ handleClick }) => { + const router = useRouter(); + const { workspaceSlug, projectId, cycleId } = router.query; + + const { data: cycleDetails } = useSWR( + cycleId ? CYCLE_DETAILS(cycleId as string) : null, + workspaceSlug && projectId && cycleId + ? () => + cycleServices.getCycleDetails( + workspaceSlug as string, + projectId as string, + cycleId as string + ) + : null + ); + + const transferableIssuesCount = cycleDetails + ? cycleDetails.backlog_issues + cycleDetails.unstarted_issues + cycleDetails.started_issues + : 0; + return ( +
+
+ + Completed cycles are not editable. +
+ + {transferableIssuesCount > 0 && ( +
+ + + Transfer Issues + +
+ )} +
+ ); +};