diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/MilestoneAutomation.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/MilestoneAutomation.tsx index aaef03dfec..c46c1e97ce 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/MilestoneAutomation.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/MilestoneAutomation.tsx @@ -10,6 +10,7 @@ import { MilestoneAutomationSection } from '../ReleasePlanMilestone/MilestoneAut import { MilestoneTransitionDisplay } from '../ReleasePlanMilestone/MilestoneTransitionDisplay.tsx'; import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx'; import { MilestoneProgressionForm } from '../MilestoneProgressionForm/MilestoneProgressionForm.tsx'; +import type { PendingProgressionChange } from './ReleasePlanMilestoneItem'; const StyledAddAutomationButton = styled(Button)(({ theme }) => ({ textTransform: 'none', @@ -53,9 +54,7 @@ interface MilestoneAutomationProps { readonly: boolean | undefined; isProgressionFormOpen: boolean; effectiveTransitionCondition: IReleasePlanMilestone['transitionCondition']; - hasPendingCreate: boolean; - hasPendingUpdate: boolean; - hasPendingDelete: boolean; + pendingProgressionChange: PendingProgressionChange | null; onOpenProgressionForm: () => void; onCloseProgressionForm: () => void; onCreateProgression: ( @@ -76,9 +75,7 @@ export const MilestoneAutomation = ({ readonly, isProgressionFormOpen, effectiveTransitionCondition, - hasPendingCreate, - hasPendingUpdate, - hasPendingDelete, + pendingProgressionChange, onOpenProgressionForm, onCloseProgressionForm, onCreateProgression, @@ -92,6 +89,13 @@ export const MilestoneAutomation = ({ return null; } + const hasPendingCreate = + pendingProgressionChange?.action === 'createMilestoneProgression'; + const hasPendingUpdate = + pendingProgressionChange?.action === 'updateMilestoneProgression'; + const hasPendingDelete = + pendingProgressionChange?.action === 'deleteMilestoneProgression'; + return ( {isProgressionFormOpen ? ( diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx index 61f760ffdb..94c69637a8 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx @@ -168,12 +168,8 @@ export const ReleasePlanMilestoneItem = ({ environmentIsDisabled, ); - const { - hasPendingCreate, - hasPendingUpdate, - hasPendingDelete, - effectiveTransitionCondition, - } = usePendingProgressionChanges(milestone, getPendingProgressionChange); + const { pendingProgressionChange, effectiveTransitionCondition } = + usePendingProgressionChanges(milestone, getPendingProgressionChange); const automationSection = ( { const pendingProgressionChange = getPendingProgressionChange(milestone.id); - const hasPendingCreate = - pendingProgressionChange?.action === 'createMilestoneProgression'; - const hasPendingUpdate = - pendingProgressionChange?.action === 'updateMilestoneProgression'; - const hasPendingDelete = - pendingProgressionChange?.action === 'deleteMilestoneProgression'; - // Determine effective transition condition (use pending create if exists) let effectiveTransitionCondition = milestone.transitionCondition; if ( @@ -33,9 +27,7 @@ export const usePendingProgressionChanges = ( } return { - hasPendingCreate, - hasPendingUpdate, - hasPendingDelete, + pendingProgressionChange, effectiveTransitionCondition, }; };