diff --git a/web/ce/components/cycles/additional-actions.tsx b/web/ce/components/cycles/additional-actions.tsx new file mode 100644 index 00000000000..1fcb7146fca --- /dev/null +++ b/web/ce/components/cycles/additional-actions.tsx @@ -0,0 +1,7 @@ +import { FC } from "react"; +import { observer } from "mobx-react"; +type Props = { + cycleId: string; + projectId: string; +}; +export const CycleAdditionalActions: FC = observer(() => <>); diff --git a/web/ce/components/cycles/end-cycle/index.ts b/web/ce/components/cycles/end-cycle/index.ts new file mode 100644 index 00000000000..2e60c456193 --- /dev/null +++ b/web/ce/components/cycles/end-cycle/index.ts @@ -0,0 +1,2 @@ +export * from "./modal"; +export * from "./use-end-cycle"; diff --git a/web/ce/components/cycles/end-cycle/modal.tsx b/web/ce/components/cycles/end-cycle/modal.tsx new file mode 100644 index 00000000000..de66c1a9cbd --- /dev/null +++ b/web/ce/components/cycles/end-cycle/modal.tsx @@ -0,0 +1,12 @@ +import React from "react"; + +interface Props { + isOpen: boolean; + handleClose: () => void; + cycleId: string; + projectId: string; + workspaceSlug: string; + transferrableIssuesCount: number; +} + +export const EndCycleModal: React.FC = () => <>; diff --git a/web/ce/components/cycles/end-cycle/use-end-cycle.tsx b/web/ce/components/cycles/end-cycle/use-end-cycle.tsx new file mode 100644 index 00000000000..c1bf6261855 --- /dev/null +++ b/web/ce/components/cycles/end-cycle/use-end-cycle.tsx @@ -0,0 +1,7 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export const useEndCycle = (isCurrentCycle: boolean) => ({ + isEndCycleModalOpen: false, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setEndCycleModalOpen: (value: boolean) => {}, + endCycleContextMenu: undefined, +}); diff --git a/web/ce/components/cycles/index.ts b/web/ce/components/cycles/index.ts index 89934687567..1da1150255f 100644 --- a/web/ce/components/cycles/index.ts +++ b/web/ce/components/cycles/index.ts @@ -1,2 +1,4 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; +export * from "./additional-actions"; +export * from "./end-cycle"; diff --git a/web/core/components/cycles/list/cycle-list-item-action.tsx b/web/core/components/cycles/list/cycle-list-item-action.tsx index fca9ede6750..2fa3d4fd346 100644 --- a/web/core/components/cycles/list/cycle-list-item-action.tsx +++ b/web/core/components/cycles/list/cycle-list-item-action.tsx @@ -33,7 +33,8 @@ import { generateQueryParams } from "@/helpers/router.helper"; import { useCycle, useEventTracker, useMember, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; import { usePlatformOS } from "@/hooks/use-platform-os"; -// plane web +// plane web components +import { CycleAdditionalActions } from "@/plane-web/components/cycles"; // plane web constants import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions"; // services @@ -156,7 +157,7 @@ export const CycleListItemAction: FC = observer((props) => { try { const res = await cycleService.cycleDateCheck(workspaceSlug as string, projectId as string, payload); return res.status; - } catch (err) { + } catch { return false; } }; @@ -244,6 +245,7 @@ export const CycleListItemAction: FC = observer((props) => { )} + {showTransferIssues && (
= observer((props) => { const cycleDetails = getCycleById(cycleId); const isArchived = !!cycleDetails?.archived_at; const isCompleted = cycleDetails?.status?.toLowerCase() === "completed"; + const isCurrentCycle = cycleDetails?.status?.toLowerCase() === "current"; + const transferableIssuesCount = cycleDetails ? cycleDetails.total_issues - cycleDetails.completed_issues : 0; // auth const isEditingAllowed = allowPermissions( [EUserPermissions.ADMIN, EUserPermissions.MEMBER], @@ -48,6 +51,8 @@ export const CycleQuickActions: React.FC = observer((props) => { projectId ); + const { isEndCycleModalOpen, setEndCycleModalOpen, endCycleContextMenu } = useEndCycle(isCurrentCycle); + const cycleLink = `${workspaceSlug}/projects/${projectId}/cycles/${cycleId}`; const handleCopyText = () => copyUrlToClipboard(cycleLink).then(() => { @@ -138,6 +143,8 @@ export const CycleQuickActions: React.FC = observer((props) => { }, ]; + if (endCycleContextMenu) MENU_ITEMS.splice(3, 0, endCycleContextMenu); + return ( <> {cycleDetails && ( @@ -163,6 +170,14 @@ export const CycleQuickActions: React.FC = observer((props) => { workspaceSlug={workspaceSlug} projectId={projectId} /> + setEndCycleModalOpen(false)} + cycleId={cycleId} + projectId={projectId} + workspaceSlug={workspaceSlug} + transferrableIssuesCount={transferableIssuesCount} + />
)} diff --git a/web/ee/components/cycles/end-cycle/index.ts b/web/ee/components/cycles/end-cycle/index.ts new file mode 100644 index 00000000000..3d772e91cf9 --- /dev/null +++ b/web/ee/components/cycles/end-cycle/index.ts @@ -0,0 +1 @@ +export * from "ce/components/cycles/end-cycle"; diff --git a/web/ee/components/cycles/index.ts b/web/ee/components/cycles/index.ts index 89934687567..30d8e85dd0c 100644 --- a/web/ee/components/cycles/index.ts +++ b/web/ee/components/cycles/index.ts @@ -1,2 +1,4 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; +export * from "./end-cycle"; +export * from "ce/components/cycles/additional-actions";