From 0bcdf82e375d705d5b538cfcd2414ad66f80a35d Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Fri, 7 Nov 2025 13:51:14 +0100 Subject: [PATCH] feat: add safeguard button and borders (#10943) --- .../ReleasePlan/ReleasePlan.tsx | 100 ++++++++++++------ .../MilestoneAutomation.tsx | 33 +----- .../StyledActionButton.tsx | 28 +++++ .../ReleasePlan/StyledActionButton.tsx | 0 4 files changed, 100 insertions(+), 61 deletions(-) create mode 100644 frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/StyledActionButton.tsx create mode 100644 frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/StyledActionButton.tsx diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx index 2bd40ae149..7b07c7e587 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx @@ -28,6 +28,9 @@ import { useMilestoneProgressionsApi } from 'hooks/api/actions/useMilestoneProgr import { DeleteProgressionDialog } from './DeleteProgressionDialog.tsx'; import type { ChangeMilestoneProgressionSchema } from 'openapi'; import { ReleasePlanMilestoneItem } from './ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx'; +import Add from '@mui/icons-material/Add'; + +import { StyledActionButton } from './ReleasePlanMilestoneItem/StyledActionButton.tsx'; const StyledContainer = styled('div')(({ theme }) => ({ padding: theme.spacing(2), @@ -69,9 +72,30 @@ const StyledHeaderDescription = styled('p')(({ theme }) => ({ color: theme.palette.text.secondary, })); -const StyledBody = styled('div')(({ theme }) => ({ +const StyledBody = styled('div', { + shouldForwardProp: (prop) => prop !== 'safeguards', +})<{ safeguards: boolean }>(({ theme, safeguards }) => ({ display: 'flex', flexDirection: 'column', + ...(safeguards && { + border: `1px dashed ${theme.palette.neutral.border}`, + borderRadius: theme.shape.borderRadiusMedium, + padding: theme.spacing(0.5, 0), + }), +})); + +const StyledAddSafeguard = styled('div')(({ theme }) => ({ + display: 'flex', + borderBottom: `1px dashed ${theme.palette.neutral.border}`, + padding: theme.spacing(1.5, 2), +})); + +const StyledMilestones = styled('div', { + shouldForwardProp: (prop) => prop !== 'safeguards', +})<{ safeguards: boolean }>(({ theme, safeguards }) => ({ + ...(safeguards && { + padding: theme.spacing(1.5, 1.5), + }), })); interface IReleasePlanProps { @@ -163,6 +187,7 @@ export const ReleasePlan = ({ return null; }; const milestoneProgressionsEnabled = useUiFlag('milestoneProgression'); + const safeguardsEnabled = useUiFlag('safeguards'); const [progressionFormOpenIndex, setProgressionFormOpenIndex] = useState< number | null >(null); @@ -378,36 +403,49 @@ export const ReleasePlan = ({ )} - - {milestones.map((milestone, index) => ( - - ))} + + {safeguardsEnabled ? ( + + {}} + color='primary' + startIcon={} + > + Add safeguard + + + ) : null} + + {milestones.map((milestone, index) => ( + + ))} + ({ - textTransform: 'none', - fontWeight: theme.typography.fontWeightBold, - fontSize: theme.typography.body2.fontSize, - padding: 0, - minWidth: 'auto', - gap: theme.spacing(1), - '&:hover': { - backgroundColor: 'transparent', - }, - '& .MuiButton-startIcon': { - margin: 0, - width: 20, - height: 20, - border: `1px solid ${theme.palette.primary.main}`, - backgroundColor: theme.palette.background.elevation2, - borderRadius: '50%', - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - '& svg': { - fontSize: 14, - color: theme.palette.primary.main, - }, - }, -})); +import { StyledActionButton } from './StyledActionButton.tsx'; interface MilestoneAutomationProps { milestone: IReleasePlanMilestone; @@ -112,13 +85,13 @@ export const MilestoneAutomation = ({ badge={badge} /> ) : ( - } > Add automation - + )} ); diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/StyledActionButton.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/StyledActionButton.tsx new file mode 100644 index 0000000000..1df529468e --- /dev/null +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/StyledActionButton.tsx @@ -0,0 +1,28 @@ +import { Button, styled } from '@mui/material'; + +export const StyledActionButton = styled(Button)(({ theme }) => ({ + textTransform: 'none', + fontWeight: theme.typography.fontWeightBold, + fontSize: theme.typography.body2.fontSize, + padding: 0, + minWidth: 'auto', + gap: theme.spacing(1), + '&:hover': { + backgroundColor: 'transparent', + }, + '& .MuiButton-startIcon': { + margin: 0, + width: 20, + height: 20, + border: `1px solid ${theme.palette.primary.main}`, + backgroundColor: theme.palette.background.elevation2, + borderRadius: '50%', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + '& svg': { + fontSize: 14, + color: theme.palette.primary.main, + }, + }, +})); diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/StyledActionButton.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/StyledActionButton.tsx new file mode 100644 index 0000000000..e69de29bb2