1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-10 01:16:39 +02: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, strategy,
}) => { }) => {
const { parameters, constraints = [] } = strategy; const { parameters, constraints = [] } = strategy;
const stickiness = parameters?.stickiness;
const explainStickiness =
typeof stickiness === 'string' && stickiness !== 'default';
const { strategies } = useStrategies(); const { strategies } = useStrategies();
const { segments } = useSegments(); const { segments } = useSegments();
const strategySegments = segments?.filter((segment) => { const strategySegments = segments?.filter((segment) => {
@ -112,6 +115,15 @@ export const StrategyExecution: VFC<IStrategyExecutionProps> = ({
<div> <div>
<Badge color={badgeType}>{percentage}%</Badge>{' '} <Badge color={badgeType}>{percentage}%</Badge>{' '}
<span>of your base</span>{' '} <span>of your base</span>{' '}
<span>
{explainStickiness ? (
<>
with <strong>{stickiness}</strong>
</>
) : (
''
)}{' '}
</span>
<span> <span>
{constraints.length > 0 {constraints.length > 0
? 'who match constraints' ? 'who match constraints'

View File

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