1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: change CR strategy title and name behaviour (#4004)

This commit is contained in:
Jaanus Sellin 2023-06-19 13:33:12 +03:00 committed by GitHub
parent 16a3f6069c
commit 54654c6368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,36 @@ export const StrategyDiff: FC<{
</StyledCodeSection> </StyledCodeSection>
); );
}; };
export const StrategyName: FC<{
change:
| IChangeRequestAddStrategy
| IChangeRequestUpdateStrategy
| IChangeRequestDeleteStrategy;
previousTitle: string | undefined;
}> = ({ change, previousTitle }) => {
return (
<>
<ConditionallyRender
condition={Boolean(
previousTitle && previousTitle !== change.payload.title
)}
show={
<Truncated>
<Typography component="span" color="text.secondary">
{previousTitle ||
formatStrategyName(change.payload.name)}
</Typography>{' '}
</Truncated>
}
/>
<Truncated>
<Typography component="span">{change.payload.title}</Typography>
</Truncated>
</>
);
};
interface IStrategyTooltipLinkProps { interface IStrategyTooltipLinkProps {
change: change:
| IChangeRequestAddStrategy | IChangeRequestAddStrategy
@ -76,21 +106,6 @@ export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({
}) => ( }) => (
<StyledContainer> <StyledContainer>
<GetFeatureStrategyIcon strategyName={change.payload.name} /> <GetFeatureStrategyIcon strategyName={change.payload.name} />
<Truncated>
<ConditionallyRender
condition={Boolean(
(previousTitle && previousTitle !== change.payload.title) ||
(!previousTitle && change.payload.title)
)}
show={
<Truncated>
<Typography component="s" color="text.secondary">
{previousTitle ||
formatStrategyName(change.payload.name)}
</Typography>{' '}
</Truncated>
}
/>
<Truncated> <Truncated>
<TooltipLink <TooltipLink
tooltip={children} tooltip={children}
@ -100,11 +115,10 @@ export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({
}} }}
> >
<Typography component="span"> <Typography component="span">
{change.payload.title || {formatStrategyName(change.payload.name)}
formatStrategyName(change.payload.name)}
</Typography> </Typography>
</TooltipLink> </TooltipLink>
</Truncated> {<StrategyName change={change} previousTitle={previousTitle} />}
</Truncated> </Truncated>
</StyledContainer> </StyledContainer>
); );