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 + +
+ )} +
+ ); +};