Skip to content

Commit f5b2634

Browse files
chore: Updates change request sidebar to remove env/cloud icon (#9577)
Removes the cloud icon in the change request env header to better align with the new env headers in the flag environment overview. Also hides strategy variants in favor of using the new strategy execution component. As a bonus: also uses a link component instead of a button for navigating to the change request page. With flag enabled: ![image](https://github.com/user-attachments/assets/0391c845-d68c-44fa-a747-1c21f5a9c2f4) ![image](https://github.com/user-attachments/assets/ac84be9b-15fb-4d0b-9737-69643332fa23)
1 parent ac96797 commit f5b2634

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { flexRow } from 'themes/themeStyles';
2121
import { EnvironmentVariantsTable } from 'component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/EnvironmentVariantsCard/EnvironmentVariantsTable/EnvironmentVariantsTable';
2222
import { ChangeOverwriteWarning } from './ChangeOverwriteWarning/ChangeOverwriteWarning';
2323
import type { IFeatureStrategy } from 'interfaces/strategy';
24+
import { useUiFlag } from 'hooks/useUiFlag';
2425

2526
export const ChangeItemWrapper = styled(Box)({
2627
display: 'flex',
@@ -271,6 +272,7 @@ const AddStrategy: FC<{
271272
change: IChangeRequestAddStrategy;
272273
actions?: ReactNode;
273274
}> = ({ change, actions }) => {
275+
const showOldStrategyVariants = !useUiFlag('flagOverviewRedesign');
274276
return (
275277
<>
276278
<ChangeItemCreateEditDeleteWrapper>
@@ -303,16 +305,18 @@ const AddStrategy: FC<{
303305
<div>{actions}</div>
304306
</ChangeItemCreateEditDeleteWrapper>
305307
<StrategyExecution strategy={change.payload} />
306-
{change.payload.variants && change.payload.variants.length > 0 && (
307-
<StyledBox>
308-
<StyledTypography>
309-
Setting strategy variants to:
310-
</StyledTypography>
311-
<EnvironmentVariantsTable
312-
variants={change.payload.variants}
313-
/>
314-
</StyledBox>
315-
)}
308+
{showOldStrategyVariants &&
309+
change.payload.variants &&
310+
change.payload.variants.length > 0 && (
311+
<StyledBox>
312+
<StyledTypography>
313+
Setting strategy variants to:
314+
</StyledTypography>
315+
<EnvironmentVariantsTable
316+
variants={change.payload.variants}
317+
/>
318+
</StyledBox>
319+
)}
316320
</>
317321
);
318322
};

frontend/src/component/changeRequest/ChangeRequestSidebar/EnvironmentChangeRequest/EnvironmentChangeRequest.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
useTheme,
1010
} from '@mui/material';
1111
import type { ChangeRequestType } from '../../changeRequest.types';
12-
import { useNavigate } from 'react-router-dom';
12+
import { Link } from 'react-router-dom';
1313
import { ChangeRequestStatusBadge } from '../../ChangeRequestStatusBadge/ChangeRequestStatusBadge';
1414
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
1515
import { changesCount } from '../../changesCount';
@@ -25,6 +25,7 @@ import Input from 'component/common/Input/Input';
2525
import { ChangeRequestTitle } from './ChangeRequestTitle';
2626
import { UpdateCount } from 'component/changeRequest/UpdateCount';
2727
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
28+
import { useUiFlag } from 'hooks/useUiFlag';
2829

2930
const SubmitChangeRequestButton: FC<{
3031
onClick: () => void;
@@ -69,7 +70,7 @@ export const EnvironmentChangeRequest: FC<{
6970
children?: React.ReactNode;
7071
}> = ({ environmentChangeRequest, onClose, onReview, onDiscard, children }) => {
7172
const theme = useTheme();
72-
const navigate = useNavigate();
73+
const showCloudIcon = !useUiFlag('flagOverviewRedesign');
7374
const [commentText, setCommentText] = useState('');
7475
const { user } = useAuthUser();
7576
const [title, setTitle] = useState(environmentChangeRequest.title);
@@ -97,12 +98,14 @@ export const EnvironmentChangeRequest: FC<{
9798
alignItems: 'center',
9899
}}
99100
>
100-
<CloudCircle
101-
sx={(theme) => ({
102-
color: theme.palette.primary.light,
103-
mr: 0.5,
104-
})}
105-
/>
101+
{showCloudIcon ? (
102+
<CloudCircle
103+
sx={(theme) => ({
104+
color: theme.palette.primary.light,
105+
mr: 0.5,
106+
})}
107+
/>
108+
) : null}
106109
<Typography component='span' variant='h2'>
107110
{environmentChangeRequest.environment}
108111
</Typography>
@@ -201,11 +204,10 @@ export const EnvironmentChangeRequest: FC<{
201204
<Button
202205
sx={{ marginLeft: 2 }}
203206
variant='outlined'
207+
component={Link}
208+
to={`/projects/${environmentChangeRequest.project}/change-requests/${environmentChangeRequest.id}`}
204209
onClick={() => {
205210
onClose();
206-
navigate(
207-
`/projects/${environmentChangeRequest.project}/change-requests/${environmentChangeRequest.id}`,
208-
);
209211
}}
210212
>
211213
View change request page

0 commit comments

Comments
 (0)