2022-05-02 15:52:41 +02:00
|
|
|
import { Alert } from '@mui/material';
|
2022-06-02 10:58:55 +02:00
|
|
|
import { useSegmentLimits } from 'hooks/api/getters/useSegmentLimits/useSegmentLimits';
|
2022-04-07 14:47:24 +02:00
|
|
|
|
|
|
|
export const SegmentDocsValuesWarning = () => {
|
2022-06-02 10:58:55 +02:00
|
|
|
const { segmentValuesLimit } = useSegmentLimits();
|
|
|
|
|
|
|
|
if (typeof segmentValuesLimit === 'undefined') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-04-07 14:47:24 +02:00
|
|
|
return (
|
|
|
|
<Alert severity="warning">
|
2022-06-22 14:48:55 +02:00
|
|
|
Segments is an experimental feature, currently limited to at most{' '}
|
|
|
|
{segmentValuesLimit} values. <SegmentLimitsLink />
|
2022-04-07 14:47:24 +02:00
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SegmentDocsValuesError = (props: { values: number }) => {
|
2022-06-02 10:58:55 +02:00
|
|
|
const { segmentValuesLimit } = useSegmentLimits();
|
|
|
|
|
|
|
|
if (typeof segmentValuesLimit === 'undefined') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-04-07 14:47:24 +02:00
|
|
|
return (
|
|
|
|
<Alert severity="error">
|
2022-06-02 10:58:55 +02:00
|
|
|
Segments are limited to at most {segmentValuesLimit} values. This
|
2022-04-07 14:47:24 +02:00
|
|
|
segment currently has {props.values}{' '}
|
|
|
|
{props.values === 1 ? 'value' : 'values'}.
|
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SegmentDocsStrategyWarning = () => {
|
2022-06-02 10:58:55 +02:00
|
|
|
const { strategySegmentsLimit } = useSegmentLimits();
|
|
|
|
|
|
|
|
if (typeof strategySegmentsLimit === 'undefined') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-04-07 14:47:24 +02:00
|
|
|
return (
|
|
|
|
<Alert severity="warning">
|
2022-06-02 10:58:55 +02:00
|
|
|
Strategies are limited to {strategySegmentsLimit} segments.{' '}
|
2022-04-07 14:47:24 +02:00
|
|
|
<SegmentLimitsLink />
|
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const SegmentLimitsLink = () => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
Please{' '}
|
|
|
|
<a
|
|
|
|
href="https://slack.unleash.run"
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
|
|
|
style={{ color: 'inherit' }}
|
|
|
|
>
|
|
|
|
get in touch
|
|
|
|
</a>{' '}
|
|
|
|
if you would like this limit increased.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const segmentsDocsLink = 'https://docs.getunleash.io/reference/segments';
|