[WEB-1964]chore: cycles actions restructuring (#6298)
* chore: cycles quick actions restructuring * chore: added additional actions to cycle list actions * chore: cycle quick action structure * chore: added additional actions to cycle list actions * chore: added end cycle hook * fix: updated end cycle export --------- Co-authored-by: gurusinath <gurusainath007@gmail.com>
This commit is contained in:
parent
5e6c02358d
commit
6a13a64996
10 changed files with 53 additions and 3 deletions
7
web/ce/components/cycles/additional-actions.tsx
Normal file
7
web/ce/components/cycles/additional-actions.tsx
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { FC } from "react";
|
||||||
|
import { observer } from "mobx-react";
|
||||||
|
type Props = {
|
||||||
|
cycleId: string;
|
||||||
|
projectId: string;
|
||||||
|
};
|
||||||
|
export const CycleAdditionalActions: FC<Props> = observer(() => <></>);
|
||||||
2
web/ce/components/cycles/end-cycle/index.ts
Normal file
2
web/ce/components/cycles/end-cycle/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * from "./modal";
|
||||||
|
export * from "./use-end-cycle";
|
||||||
12
web/ce/components/cycles/end-cycle/modal.tsx
Normal file
12
web/ce/components/cycles/end-cycle/modal.tsx
Normal file
|
|
@ -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<Props> = () => <></>;
|
||||||
7
web/ce/components/cycles/end-cycle/use-end-cycle.tsx
Normal file
7
web/ce/components/cycles/end-cycle/use-end-cycle.tsx
Normal file
|
|
@ -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,
|
||||||
|
});
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
export * from "./active-cycle";
|
export * from "./active-cycle";
|
||||||
export * from "./analytics-sidebar";
|
export * from "./analytics-sidebar";
|
||||||
|
export * from "./additional-actions";
|
||||||
|
export * from "./end-cycle";
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ import { generateQueryParams } from "@/helpers/router.helper";
|
||||||
import { useCycle, useEventTracker, useMember, useUserPermissions } from "@/hooks/store";
|
import { useCycle, useEventTracker, useMember, useUserPermissions } from "@/hooks/store";
|
||||||
import { useAppRouter } from "@/hooks/use-app-router";
|
import { useAppRouter } from "@/hooks/use-app-router";
|
||||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||||
// plane web
|
// plane web components
|
||||||
|
import { CycleAdditionalActions } from "@/plane-web/components/cycles";
|
||||||
// plane web constants
|
// plane web constants
|
||||||
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
|
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
|
||||||
// services
|
// services
|
||||||
|
|
@ -156,7 +157,7 @@ export const CycleListItemAction: FC<Props> = observer((props) => {
|
||||||
try {
|
try {
|
||||||
const res = await cycleService.cycleDateCheck(workspaceSlug as string, projectId as string, payload);
|
const res = await cycleService.cycleDateCheck(workspaceSlug as string, projectId as string, payload);
|
||||||
return res.status;
|
return res.status;
|
||||||
} catch (err) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -244,6 +245,7 @@ export const CycleListItemAction: FC<Props> = observer((props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<CycleAdditionalActions cycleId={cycleId} projectId={projectId} />
|
||||||
{showTransferIssues && (
|
{showTransferIssues && (
|
||||||
<div
|
<div
|
||||||
className="px-2 h-6 text-custom-primary-200 flex items-center gap-1 cursor-pointer"
|
className="px-2 h-6 text-custom-primary-200 flex items-center gap-1 cursor-pointer"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import type { TCycleGroups } from "@plane/types";
|
||||||
import { CircularProgressIndicator } from "@plane/ui";
|
import { CircularProgressIndicator } from "@plane/ui";
|
||||||
// components
|
// components
|
||||||
import { ListItem } from "@/components/core/list";
|
import { ListItem } from "@/components/core/list";
|
||||||
|
import { CycleQuickActions } from "@/components/cycles/";
|
||||||
import { CycleListItemAction } from "@/components/cycles/list";
|
import { CycleListItemAction } from "@/components/cycles/list";
|
||||||
// helpers
|
// helpers
|
||||||
import { generateQueryParams } from "@/helpers/router.helper";
|
import { generateQueryParams } from "@/helpers/router.helper";
|
||||||
|
|
@ -18,7 +19,6 @@ import { generateQueryParams } from "@/helpers/router.helper";
|
||||||
import { useCycle } from "@/hooks/store";
|
import { useCycle } from "@/hooks/store";
|
||||||
import { useAppRouter } from "@/hooks/use-app-router";
|
import { useAppRouter } from "@/hooks/use-app-router";
|
||||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||||
import { CycleQuickActions } from "../quick-actions";
|
|
||||||
|
|
||||||
type TCyclesListItem = {
|
type TCyclesListItem = {
|
||||||
cycleId: string;
|
cycleId: string;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||||
// hooks
|
// hooks
|
||||||
import { useCycle, useEventTracker, useUserPermissions } from "@/hooks/store";
|
import { useCycle, useEventTracker, useUserPermissions } from "@/hooks/store";
|
||||||
import { useAppRouter } from "@/hooks/use-app-router";
|
import { useAppRouter } from "@/hooks/use-app-router";
|
||||||
|
import { useEndCycle, EndCycleModal } from "@/plane-web/components/cycles";
|
||||||
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
|
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
@ -40,6 +41,8 @@ export const CycleQuickActions: React.FC<Props> = observer((props) => {
|
||||||
const cycleDetails = getCycleById(cycleId);
|
const cycleDetails = getCycleById(cycleId);
|
||||||
const isArchived = !!cycleDetails?.archived_at;
|
const isArchived = !!cycleDetails?.archived_at;
|
||||||
const isCompleted = cycleDetails?.status?.toLowerCase() === "completed";
|
const isCompleted = cycleDetails?.status?.toLowerCase() === "completed";
|
||||||
|
const isCurrentCycle = cycleDetails?.status?.toLowerCase() === "current";
|
||||||
|
const transferableIssuesCount = cycleDetails ? cycleDetails.total_issues - cycleDetails.completed_issues : 0;
|
||||||
// auth
|
// auth
|
||||||
const isEditingAllowed = allowPermissions(
|
const isEditingAllowed = allowPermissions(
|
||||||
[EUserPermissions.ADMIN, EUserPermissions.MEMBER],
|
[EUserPermissions.ADMIN, EUserPermissions.MEMBER],
|
||||||
|
|
@ -48,6 +51,8 @@ export const CycleQuickActions: React.FC<Props> = observer((props) => {
|
||||||
projectId
|
projectId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { isEndCycleModalOpen, setEndCycleModalOpen, endCycleContextMenu } = useEndCycle(isCurrentCycle);
|
||||||
|
|
||||||
const cycleLink = `${workspaceSlug}/projects/${projectId}/cycles/${cycleId}`;
|
const cycleLink = `${workspaceSlug}/projects/${projectId}/cycles/${cycleId}`;
|
||||||
const handleCopyText = () =>
|
const handleCopyText = () =>
|
||||||
copyUrlToClipboard(cycleLink).then(() => {
|
copyUrlToClipboard(cycleLink).then(() => {
|
||||||
|
|
@ -138,6 +143,8 @@ export const CycleQuickActions: React.FC<Props> = observer((props) => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (endCycleContextMenu) MENU_ITEMS.splice(3, 0, endCycleContextMenu);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{cycleDetails && (
|
{cycleDetails && (
|
||||||
|
|
@ -163,6 +170,14 @@ export const CycleQuickActions: React.FC<Props> = observer((props) => {
|
||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
/>
|
/>
|
||||||
|
<EndCycleModal
|
||||||
|
isOpen={isEndCycleModalOpen}
|
||||||
|
handleClose={() => setEndCycleModalOpen(false)}
|
||||||
|
cycleId={cycleId}
|
||||||
|
projectId={projectId}
|
||||||
|
workspaceSlug={workspaceSlug}
|
||||||
|
transferrableIssuesCount={transferableIssuesCount}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<ContextMenu parentRef={parentRef} items={MENU_ITEMS} />
|
<ContextMenu parentRef={parentRef} items={MENU_ITEMS} />
|
||||||
|
|
|
||||||
1
web/ee/components/cycles/end-cycle/index.ts
Normal file
1
web/ee/components/cycles/end-cycle/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "ce/components/cycles/end-cycle";
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
export * from "./active-cycle";
|
export * from "./active-cycle";
|
||||||
export * from "./analytics-sidebar";
|
export * from "./analytics-sidebar";
|
||||||
|
export * from "./end-cycle";
|
||||||
|
export * from "ce/components/cycles/additional-actions";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue