From b06d718b89d3f5a24c1e27c2a0e04dd06d8b8f6b Mon Sep 17 00:00:00 2001 From: Vamsi krishna Date: Thu, 2 Jan 2025 12:02:03 +0530 Subject: [PATCH 1/6] chore: cycles quick actions restructuring --- web/ce/components/cycles/index.ts | 1 + web/{core => ce}/components/cycles/quick-actions.tsx | 0 web/core/components/cycles/index.ts | 1 - web/core/components/cycles/list/cycle-list-item-action.tsx | 5 +++-- web/core/components/cycles/list/cycles-list-item.tsx | 3 ++- web/ee/components/cycles/index.ts | 1 + 6 files changed, 7 insertions(+), 4 deletions(-) rename web/{core => ce}/components/cycles/quick-actions.tsx (100%) diff --git a/web/ce/components/cycles/index.ts b/web/ce/components/cycles/index.ts index 89934687567..48f9a80aa6f 100644 --- a/web/ce/components/cycles/index.ts +++ b/web/ce/components/cycles/index.ts @@ -1,2 +1,3 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; +export * from "./quick-actions"; diff --git a/web/core/components/cycles/quick-actions.tsx b/web/ce/components/cycles/quick-actions.tsx similarity index 100% rename from web/core/components/cycles/quick-actions.tsx rename to web/ce/components/cycles/quick-actions.tsx diff --git a/web/core/components/cycles/index.ts b/web/core/components/cycles/index.ts index 7013beeabac..4c436509576 100644 --- a/web/core/components/cycles/index.ts +++ b/web/core/components/cycles/index.ts @@ -8,7 +8,6 @@ export * from "./cycles-view"; export * from "./delete-modal"; export * from "./form"; export * from "./modal"; -export * from "./quick-actions"; export * from "./transfer-issues-modal"; export * from "./transfer-issues"; export * from "./cycles-view-header"; 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 d83256b89bc..c42bcd3aee9 100644 --- a/web/core/components/cycles/list/cycle-list-item-action.tsx +++ b/web/core/components/cycles/list/cycle-list-item-action.tsx @@ -19,7 +19,6 @@ import { setToast, } from "@plane/ui"; // components -import { CycleQuickActions } from "@/components/cycles"; import { DateRangeDropdown } from "@/components/dropdowns"; import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; // constants @@ -32,6 +31,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 components +import { CycleQuickActions } from "@/plane-web/components/cycles"; // plane web constants import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions"; // services @@ -150,7 +151,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; } }; diff --git a/web/core/components/cycles/list/cycles-list-item.tsx b/web/core/components/cycles/list/cycles-list-item.tsx index 5954a0a7f33..016265cd369 100644 --- a/web/core/components/cycles/list/cycles-list-item.tsx +++ b/web/core/components/cycles/list/cycles-list-item.tsx @@ -18,7 +18,8 @@ import { generateQueryParams } from "@/helpers/router.helper"; import { useCycle } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; import { usePlatformOS } from "@/hooks/use-platform-os"; -import { CycleQuickActions } from "../quick-actions"; +// plane web components +import { CycleQuickActions } from "@/plane-web/components/cycles/"; type TCyclesListItem = { cycleId: string; diff --git a/web/ee/components/cycles/index.ts b/web/ee/components/cycles/index.ts index 89934687567..bcc0432d21f 100644 --- a/web/ee/components/cycles/index.ts +++ b/web/ee/components/cycles/index.ts @@ -1,2 +1,3 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; +export * from "ce/components/cycles/quick-actions"; From 330fff971b97ba666b60cbacb4d7891abad97cc4 Mon Sep 17 00:00:00 2001 From: Vamsi krishna Date: Thu, 2 Jan 2025 12:25:18 +0530 Subject: [PATCH 2/6] chore: added additional actions to cycle list actions --- web/ce/components/cycles/additional-actions.tsx | 7 +++++++ web/ce/components/cycles/index.ts | 1 + web/core/components/cycles/list/cycle-list-item-action.tsx | 4 +++- web/ee/components/cycles/index.ts | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 web/ce/components/cycles/additional-actions.tsx 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/index.ts b/web/ce/components/cycles/index.ts index 48f9a80aa6f..ac66c2eb70e 100644 --- a/web/ce/components/cycles/index.ts +++ b/web/ce/components/cycles/index.ts @@ -1,3 +1,4 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; export * from "./quick-actions"; +export * from "./additional-actions"; 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 c42bcd3aee9..b4f7a3de36e 100644 --- a/web/core/components/cycles/list/cycle-list-item-action.tsx +++ b/web/core/components/cycles/list/cycle-list-item-action.tsx @@ -32,7 +32,7 @@ import { useCycle, useEventTracker, useMember, useUserPermissions } from "@/hook import { useAppRouter } from "@/hooks/use-app-router"; import { usePlatformOS } from "@/hooks/use-platform-os"; // plane web components -import { CycleQuickActions } from "@/plane-web/components/cycles"; +import { CycleAdditionalActions, CycleQuickActions } from "@/plane-web/components/cycles"; // plane web constants import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions"; // services @@ -234,6 +234,8 @@ export const CycleListItemAction: FC = observer((props) => { )} + + {!isActive && ( Date: Thu, 2 Jan 2025 13:02:20 +0530 Subject: [PATCH 3/6] chore: cycle quick action structure --- .../components/cycles/quick-action/index.ts | 1 + .../components/cycles/quick-action/root.tsx | 24 +++++++++++++++++++ .../cycles/quick-actions/archive.tsx | 14 +++++++++++ .../components/cycles/quick-actions/exit.tsx | 14 +++++++++++ .../components/cycles/quick-actions/index.ts | 4 ++++ .../components/cycles/quick-actions/items.tsx | 14 +++++++++++ 6 files changed, 71 insertions(+) create mode 100644 web/ce/components/cycles/quick-action/index.ts create mode 100644 web/ce/components/cycles/quick-action/root.tsx create mode 100644 web/core/components/cycles/quick-actions/archive.tsx create mode 100644 web/core/components/cycles/quick-actions/exit.tsx create mode 100644 web/core/components/cycles/quick-actions/index.ts create mode 100644 web/core/components/cycles/quick-actions/items.tsx diff --git a/web/ce/components/cycles/quick-action/index.ts b/web/ce/components/cycles/quick-action/index.ts new file mode 100644 index 00000000000..1efe34c51ec --- /dev/null +++ b/web/ce/components/cycles/quick-action/index.ts @@ -0,0 +1 @@ +export * from "./root"; diff --git a/web/ce/components/cycles/quick-action/root.tsx b/web/ce/components/cycles/quick-action/root.tsx new file mode 100644 index 00000000000..ee73f250f53 --- /dev/null +++ b/web/ce/components/cycles/quick-action/root.tsx @@ -0,0 +1,24 @@ +"use client"; + +import { FC } from "react"; +import { observer } from "mobx-react"; +// components +import { QUICK_ACTION_MENU_ITEMS } from "@/components/cycles/quick-actions"; + +type TQuickActionsRoot = { + cycleId: string; +}; + +export const QuickActionsRoot: FC = observer((props) => { + const { cycleId } = props; + + return ( +
+ {QUICK_ACTION_MENU_ITEMS.map((item) => ( +
+ +
+ ))} +
+ ); +}); diff --git a/web/core/components/cycles/quick-actions/archive.tsx b/web/core/components/cycles/quick-actions/archive.tsx new file mode 100644 index 00000000000..e869ee73c4e --- /dev/null +++ b/web/core/components/cycles/quick-actions/archive.tsx @@ -0,0 +1,14 @@ +"use client"; + +import { FC } from "react"; +import { observer } from "mobx-react"; + +type TCycleQuickActionArchive = { + cycleId: string; +}; + +export const CycleQuickActionArchive: FC = observer((props) => { + const {} = props; + + return
CycleQuickActionArchive
; +}); diff --git a/web/core/components/cycles/quick-actions/exit.tsx b/web/core/components/cycles/quick-actions/exit.tsx new file mode 100644 index 00000000000..ad9aec5064c --- /dev/null +++ b/web/core/components/cycles/quick-actions/exit.tsx @@ -0,0 +1,14 @@ +"use client"; + +import { FC } from "react"; +import { observer } from "mobx-react"; + +type TCycleQuickActionEdit = { + cycleId: string; +}; + +export const CycleQuickActionEdit: FC = observer((props) => { + const {} = props; + + return
CycleQuickActionEdit
; +}); diff --git a/web/core/components/cycles/quick-actions/index.ts b/web/core/components/cycles/quick-actions/index.ts new file mode 100644 index 00000000000..773e16d986d --- /dev/null +++ b/web/core/components/cycles/quick-actions/index.ts @@ -0,0 +1,4 @@ +export * from "./items"; + +export * from "./archive"; +export * from "./exit"; diff --git a/web/core/components/cycles/quick-actions/items.tsx b/web/core/components/cycles/quick-actions/items.tsx new file mode 100644 index 00000000000..1a040bd3b86 --- /dev/null +++ b/web/core/components/cycles/quick-actions/items.tsx @@ -0,0 +1,14 @@ +import { CycleQuickActionArchive, CycleQuickActionEdit } from "."; + +export const QUICK_ACTION_ITEMS = { + archive: { + title: "Archive", + component: CycleQuickActionArchive, + }, + edit: { + title: "Edit", + component: CycleQuickActionEdit, + }, +}; + +export const QUICK_ACTION_MENU_ITEMS = [QUICK_ACTION_ITEMS.archive, QUICK_ACTION_ITEMS.edit]; From e148dcdd1aa5e6932ef78afbbcd85ad5f56108c4 Mon Sep 17 00:00:00 2001 From: Vamsi krishna Date: Thu, 2 Jan 2025 12:25:18 +0530 Subject: [PATCH 4/6] chore: added additional actions to cycle list actions From 7a4481d51728431246d317548fea6cb480548eb7 Mon Sep 17 00:00:00 2001 From: Vamsi krishna Date: Thu, 2 Jan 2025 16:21:24 +0530 Subject: [PATCH 5/6] chore: added end cycle hook --- web/ce/components/cycles/end-cycle/index.ts | 2 ++ web/ce/components/cycles/end-cycle/modal.tsx | 12 ++++++++++ .../cycles/end-cycle/use-end-cycle.tsx | 7 ++++++ web/ce/components/cycles/index.ts | 2 +- .../components/cycles/quick-action/index.ts | 1 - .../components/cycles/quick-action/root.tsx | 24 ------------------- web/core/components/cycles/index.ts | 1 + .../cycles/list/cycles-list-item.tsx | 3 +-- .../components/cycles/quick-actions.tsx | 15 ++++++++++++ .../cycles/quick-actions/archive.tsx | 14 ----------- .../components/cycles/quick-actions/exit.tsx | 14 ----------- .../components/cycles/quick-actions/index.ts | 4 ---- .../components/cycles/quick-actions/items.tsx | 14 ----------- web/ee/components/cycles/end-cycle/index.ts | 1 + web/ee/components/cycles/index.ts | 2 +- 15 files changed, 41 insertions(+), 75 deletions(-) create mode 100644 web/ce/components/cycles/end-cycle/index.ts create mode 100644 web/ce/components/cycles/end-cycle/modal.tsx create mode 100644 web/ce/components/cycles/end-cycle/use-end-cycle.tsx delete mode 100644 web/ce/components/cycles/quick-action/index.ts delete mode 100644 web/ce/components/cycles/quick-action/root.tsx rename web/{ce => core}/components/cycles/quick-actions.tsx (89%) delete mode 100644 web/core/components/cycles/quick-actions/archive.tsx delete mode 100644 web/core/components/cycles/quick-actions/exit.tsx delete mode 100644 web/core/components/cycles/quick-actions/index.ts delete mode 100644 web/core/components/cycles/quick-actions/items.tsx create mode 100644 web/ee/components/cycles/end-cycle/index.ts 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 ac66c2eb70e..1da1150255f 100644 --- a/web/ce/components/cycles/index.ts +++ b/web/ce/components/cycles/index.ts @@ -1,4 +1,4 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; -export * from "./quick-actions"; export * from "./additional-actions"; +export * from "./end-cycle"; diff --git a/web/ce/components/cycles/quick-action/index.ts b/web/ce/components/cycles/quick-action/index.ts deleted file mode 100644 index 1efe34c51ec..00000000000 --- a/web/ce/components/cycles/quick-action/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./root"; diff --git a/web/ce/components/cycles/quick-action/root.tsx b/web/ce/components/cycles/quick-action/root.tsx deleted file mode 100644 index ee73f250f53..00000000000 --- a/web/ce/components/cycles/quick-action/root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -"use client"; - -import { FC } from "react"; -import { observer } from "mobx-react"; -// components -import { QUICK_ACTION_MENU_ITEMS } from "@/components/cycles/quick-actions"; - -type TQuickActionsRoot = { - cycleId: string; -}; - -export const QuickActionsRoot: FC = observer((props) => { - const { cycleId } = props; - - return ( -
- {QUICK_ACTION_MENU_ITEMS.map((item) => ( -
- -
- ))} -
- ); -}); diff --git a/web/core/components/cycles/index.ts b/web/core/components/cycles/index.ts index 4c436509576..7013beeabac 100644 --- a/web/core/components/cycles/index.ts +++ b/web/core/components/cycles/index.ts @@ -8,6 +8,7 @@ export * from "./cycles-view"; export * from "./delete-modal"; export * from "./form"; export * from "./modal"; +export * from "./quick-actions"; export * from "./transfer-issues-modal"; export * from "./transfer-issues"; export * from "./cycles-view-header"; diff --git a/web/core/components/cycles/list/cycles-list-item.tsx b/web/core/components/cycles/list/cycles-list-item.tsx index 016265cd369..aad2f692292 100644 --- a/web/core/components/cycles/list/cycles-list-item.tsx +++ b/web/core/components/cycles/list/cycles-list-item.tsx @@ -11,6 +11,7 @@ import type { TCycleGroups } from "@plane/types"; import { CircularProgressIndicator } from "@plane/ui"; // components import { ListItem } from "@/components/core/list"; +import { CycleQuickActions } from "@/components/cycles/"; import { CycleListItemAction } from "@/components/cycles/list"; // helpers import { generateQueryParams } from "@/helpers/router.helper"; @@ -18,8 +19,6 @@ import { generateQueryParams } from "@/helpers/router.helper"; import { useCycle } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; import { usePlatformOS } from "@/hooks/use-platform-os"; -// plane web components -import { CycleQuickActions } from "@/plane-web/components/cycles/"; type TCyclesListItem = { cycleId: string; diff --git a/web/ce/components/cycles/quick-actions.tsx b/web/core/components/cycles/quick-actions.tsx similarity index 89% rename from web/ce/components/cycles/quick-actions.tsx rename to web/core/components/cycles/quick-actions.tsx index 49f78cb5c0a..b72d7b7bd61 100644 --- a/web/ce/components/cycles/quick-actions.tsx +++ b/web/core/components/cycles/quick-actions.tsx @@ -15,6 +15,7 @@ import { copyUrlToClipboard } from "@/helpers/string.helper"; // hooks import { useCycle, useEventTracker, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; +import { useEndCycle, EndCycleModal } from "@/plane-web/components/cycles"; import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions"; type Props = { @@ -40,6 +41,8 @@ export const CycleQuickActions: React.FC = 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/core/components/cycles/quick-actions/archive.tsx b/web/core/components/cycles/quick-actions/archive.tsx deleted file mode 100644 index e869ee73c4e..00000000000 --- a/web/core/components/cycles/quick-actions/archive.tsx +++ /dev/null @@ -1,14 +0,0 @@ -"use client"; - -import { FC } from "react"; -import { observer } from "mobx-react"; - -type TCycleQuickActionArchive = { - cycleId: string; -}; - -export const CycleQuickActionArchive: FC = observer((props) => { - const {} = props; - - return
CycleQuickActionArchive
; -}); diff --git a/web/core/components/cycles/quick-actions/exit.tsx b/web/core/components/cycles/quick-actions/exit.tsx deleted file mode 100644 index ad9aec5064c..00000000000 --- a/web/core/components/cycles/quick-actions/exit.tsx +++ /dev/null @@ -1,14 +0,0 @@ -"use client"; - -import { FC } from "react"; -import { observer } from "mobx-react"; - -type TCycleQuickActionEdit = { - cycleId: string; -}; - -export const CycleQuickActionEdit: FC = observer((props) => { - const {} = props; - - return
CycleQuickActionEdit
; -}); diff --git a/web/core/components/cycles/quick-actions/index.ts b/web/core/components/cycles/quick-actions/index.ts deleted file mode 100644 index 773e16d986d..00000000000 --- a/web/core/components/cycles/quick-actions/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./items"; - -export * from "./archive"; -export * from "./exit"; diff --git a/web/core/components/cycles/quick-actions/items.tsx b/web/core/components/cycles/quick-actions/items.tsx deleted file mode 100644 index 1a040bd3b86..00000000000 --- a/web/core/components/cycles/quick-actions/items.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { CycleQuickActionArchive, CycleQuickActionEdit } from "."; - -export const QUICK_ACTION_ITEMS = { - archive: { - title: "Archive", - component: CycleQuickActionArchive, - }, - edit: { - title: "Edit", - component: CycleQuickActionEdit, - }, -}; - -export const QUICK_ACTION_MENU_ITEMS = [QUICK_ACTION_ITEMS.archive, QUICK_ACTION_ITEMS.edit]; 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..d2680523a80 --- /dev/null +++ b/web/ee/components/cycles/end-cycle/index.ts @@ -0,0 +1 @@ +export * from "ce/components/views/publish"; diff --git a/web/ee/components/cycles/index.ts b/web/ee/components/cycles/index.ts index 0b01441230a..30d8e85dd0c 100644 --- a/web/ee/components/cycles/index.ts +++ b/web/ee/components/cycles/index.ts @@ -1,4 +1,4 @@ export * from "./active-cycle"; export * from "./analytics-sidebar"; -export * from "ce/components/cycles/quick-actions"; +export * from "./end-cycle"; export * from "ce/components/cycles/additional-actions"; From bcb1352550ca56a1908ea3095951d327844e4c6a Mon Sep 17 00:00:00 2001 From: Vamsi krishna Date: Thu, 2 Jan 2025 16:25:55 +0530 Subject: [PATCH 6/6] fix: updated end cycle export --- web/ee/components/cycles/end-cycle/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ee/components/cycles/end-cycle/index.ts b/web/ee/components/cycles/end-cycle/index.ts index d2680523a80..3d772e91cf9 100644 --- a/web/ee/components/cycles/end-cycle/index.ts +++ b/web/ee/components/cycles/end-cycle/index.ts @@ -1 +1 @@ -export * from "ce/components/views/publish"; +export * from "ce/components/cycles/end-cycle";