From 8fbb149b9bf367c568025dceffa9bf0b09cc24f5 Mon Sep 17 00:00:00 2001 From: FredrikOseberg Date: Fri, 24 Oct 2025 09:18:39 +0200 Subject: [PATCH] refactor: simplify badge logic for draft automations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary distinction between create and update for badge display. Both cases just need to show "Modified in draft" when there's a pending changeMilestoneProgression action. Also remove unused StyledAddAutomationContainer and badge next to "Add automation" button since pending creates now show the display component instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../MilestoneAutomation.tsx | 33 +++++-------------- 1 file changed, 8 insertions(+), 25 deletions(-) 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 660d9c69b4..0da49b965c 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/MilestoneAutomation.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/MilestoneAutomation.tsx @@ -36,12 +36,6 @@ const StyledAddAutomationButton = styled(Button)(({ theme }) => ({ }, })); -const StyledAddAutomationContainer = styled('div')(({ theme }) => ({ - display: 'flex', - alignItems: 'center', - gap: theme.spacing(1), -})); - interface MilestoneAutomationProps { milestone: IReleasePlanMilestone; status: MilestoneStatus; @@ -82,20 +76,14 @@ export const MilestoneAutomation = ({ return null; } - // When milestone has no original transitionCondition but has a pending changeMilestoneProgression, it's a create - const isOriginallyEmpty = !milestone.transitionCondition; - const hasPendingCreate = - isOriginallyEmpty && - pendingProgressionChange?.action === 'changeMilestoneProgression'; const hasPendingChange = - !isOriginallyEmpty && pendingProgressionChange?.action === 'changeMilestoneProgression'; const hasPendingDelete = pendingProgressionChange?.action === 'deleteMilestoneProgression'; const badge = hasPendingDelete ? ( Deleted in draft - ) : hasPendingChange || hasPendingCreate ? ( + ) : hasPendingChange ? ( Modified in draft ) : undefined; @@ -121,18 +109,13 @@ export const MilestoneAutomation = ({ badge={badge} /> ) : ( - - } - > - Add automation - - {hasPendingCreate && ( - Modified in draft - )} - + } + > + Add automation + )} );