From 76fdb81249fb6e95661f9296e7b27f20ad6cca10 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna <46787868+mathalav55@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:59:57 +0530 Subject: [PATCH] chore: added current cycle to cycle dropdown (#6376) --- web/core/components/dropdowns/cycle/cycle-options.tsx | 4 +++- web/core/components/dropdowns/cycle/index.tsx | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/web/core/components/dropdowns/cycle/cycle-options.tsx b/web/core/components/dropdowns/cycle/cycle-options.tsx index cd4f4d997..e720fb78c 100644 --- a/web/core/components/dropdowns/cycle/cycle-options.tsx +++ b/web/core/components/dropdowns/cycle/cycle-options.tsx @@ -31,10 +31,11 @@ type CycleOptionsProps = { placement: Placement | undefined; isOpen: boolean; canRemoveCycle: boolean; + currentCycleId?: string; }; export const CycleOptions: FC = observer((props) => { - const { projectId, isOpen, referenceElement, placement, canRemoveCycle } = props; + const { projectId, isOpen, referenceElement, placement, canRemoveCycle, currentCycleId } = props; //state hooks const [query, setQuery] = useState(""); const [popperElement, setPopperElement] = useState(null); @@ -68,6 +69,7 @@ export const CycleOptions: FC = observer((props) => { const cycleIds = (getProjectCycleIds(projectId) ?? [])?.filter((cycleId) => { const cycleDetails = getCycleById(cycleId); + if (currentCycleId && currentCycleId === cycleId) return false; return cycleDetails?.status ? (cycleDetails?.status.toLowerCase() != "completed" ? true : false) : true; }); diff --git a/web/core/components/dropdowns/cycle/index.tsx b/web/core/components/dropdowns/cycle/index.tsx index 9eb20ba2d..98124a0a1 100644 --- a/web/core/components/dropdowns/cycle/index.tsx +++ b/web/core/components/dropdowns/cycle/index.tsx @@ -26,6 +26,7 @@ type Props = TDropdownProps & { value: string | null; canRemoveCycle?: boolean; renderByDefault?: boolean; + currentCycleId?: string; }; export const CycleDropdown: React.FC = observer((props) => { @@ -49,6 +50,7 @@ export const CycleDropdown: React.FC = observer((props) => { value, canRemoveCycle = true, renderByDefault = true, + currentCycleId, } = props; // states @@ -145,6 +147,7 @@ export const CycleDropdown: React.FC = observer((props) => { placement={placement} referenceElement={referenceElement} canRemoveCycle={canRemoveCycle} + currentCycleId={currentCycleId} /> )}