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
@ -77,34 +107,18 @@ export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({
<StyledContainer> <StyledContainer>
<GetFeatureStrategyIcon strategyName={change.payload.name} /> <GetFeatureStrategyIcon strategyName={change.payload.name} />
<Truncated> <Truncated>
<ConditionallyRender <TooltipLink
condition={Boolean( tooltip={children}
(previousTitle && previousTitle !== change.payload.title) || tooltipProps={{
(!previousTitle && change.payload.title) maxWidth: 500,
)} maxHeight: 600,
show={ }}
<Truncated> >
<Typography component="s" color="text.secondary"> <Typography component="span">
{previousTitle || {formatStrategyName(change.payload.name)}
formatStrategyName(change.payload.name)} </Typography>
</Typography>{' '} </TooltipLink>
</Truncated> {<StrategyName change={change} previousTitle={previousTitle} />}
}
/>
<Truncated>
<TooltipLink
tooltip={children}
tooltipProps={{
maxWidth: 500,
maxHeight: 600,
}}
>
<Typography component="span">
{change.payload.title ||
formatStrategyName(change.payload.name)}
</Typography>
</TooltipLink>
</Truncated>
</Truncated> </Truncated>
</StyledContainer> </StyledContainer>
); );