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

feat: explain stickiness (#7248)

This commit is contained in:
Mateusz Kwasniewski 2024-06-03 13:54:06 +02:00 committed by GitHub
parent 7952d7e240
commit 7021763973
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View File

@ -77,6 +77,9 @@ export const StrategyExecution: VFC<IStrategyExecutionProps> = ({
strategy,
}) => {
const { parameters, constraints = [] } = strategy;
const stickiness = parameters?.stickiness;
const explainStickiness =
typeof stickiness === 'string' && stickiness !== 'default';
const { strategies } = useStrategies();
const { segments } = useSegments();
const strategySegments = segments?.filter((segment) => {
@ -112,6 +115,15 @@ export const StrategyExecution: VFC<IStrategyExecutionProps> = ({
<div>
<Badge color={badgeType}>{percentage}%</Badge>{' '}
<span>of your base</span>{' '}
<span>
{explainStickiness ? (
<>
with <strong>{stickiness}</strong>
</>
) : (
''
)}{' '}
</span>
<span>
{constraints.length > 0
? 'who match constraints'

View File

@ -34,6 +34,9 @@ export const PlaygroundResultStrategyExecutionParameters = ({
input,
disabled = false,
}: PlaygroundResultStrategyExecutionParametersProps) => {
const stickiness = parameters?.stickiness;
const explainStickiness =
typeof stickiness === 'string' && stickiness !== 'default';
return (
<>
{Object.keys(parameters).map((key) => {
@ -81,6 +84,16 @@ export const PlaygroundResultStrategyExecutionParameters = ({
{percentage}%
</Badge>{' '}
of your base{' '}
<span>
{explainStickiness ? (
<>
with{' '}
<strong>{stickiness}</strong>
</>
) : (
''
)}{' '}
</span>
{constraints.length > 0
? 'who match constraints'
: ''}{' '}