1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
This commit is contained in:
andreas-unleash 2022-08-04 14:34:33 +03:00
parent f97213f188
commit c142975565
2 changed files with 4 additions and 32 deletions

View File

@ -1,10 +1,9 @@
import { ConditionallyRender } from '../../../../ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from '../../../../ConditionallyRender/ConditionallyRender';
import { styled, Typography } from '@mui/material'; import { styled } from '@mui/material';
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { IConstraint } from '../../../../../../interfaces/strategy'; import { IConstraint } from '../../../../../../interfaces/strategy';
import { useStyles } from '../../../ConstraintAccordion.styles'; import { useStyles } from '../../../ConstraintAccordion.styles';
import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
const StyledValuesSpan = styled('span')(({ theme }) => ({ const StyledValuesSpan = styled('span')(({ theme }) => ({
display: '-webkit-box', display: '-webkit-box',
@ -21,7 +20,7 @@ const StyledValuesSpan = styled('span')(({ theme }) => ({
})); }));
interface ConstraintSingleValueProps { interface ConstraintSingleValueProps {
constraint: IConstraint | PlaygroundConstraintSchema; constraint: IConstraint;
expanded: boolean; expanded: boolean;
maxLength: number; maxLength: number;
allowExpand: (shouldExpand: boolean) => void; allowExpand: (shouldExpand: boolean) => void;
@ -51,21 +50,6 @@ export const ConstraintAccordionViewHeaderMultipleValues = ({
return ( return (
<div className={styles.headerValuesContainerWrapper}> <div className={styles.headerValuesContainerWrapper}>
<div className={styles.headerValuesContainer}> <div className={styles.headerValuesContainer}>
<ConditionallyRender
condition={
'result' in constraint && !Boolean(constraint.result)
}
show={
<Typography
variant={'body2'}
color={'error'}
noWrap={true}
sx={{ mr: 1 }}
>
does not match any values{' '}
</Typography>
}
/>
<StyledValuesSpan>{text}</StyledValuesSpan> <StyledValuesSpan>{text}</StyledValuesSpan>
<ConditionallyRender <ConditionallyRender
condition={expandable} condition={expandable}

View File

@ -1,11 +1,9 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Chip, styled, Typography } from '@mui/material'; import { Chip, styled } from '@mui/material';
import { formatConstraintValue } from 'utils/formatConstraintValue'; import { formatConstraintValue } from 'utils/formatConstraintValue';
import { useStyles } from '../../../ConstraintAccordion.styles'; import { useStyles } from '../../../ConstraintAccordion.styles';
import { IConstraint } from '../../../../../../interfaces/strategy'; import { IConstraint } from '../../../../../../interfaces/strategy';
import { useLocationSettings } from 'hooks/useLocationSettings'; import { useLocationSettings } from 'hooks/useLocationSettings';
import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { ConditionallyRender } from '../../../../ConditionallyRender/ConditionallyRender';
const StyledSingleValueChip = styled(Chip)(({ theme }) => ({ const StyledSingleValueChip = styled(Chip)(({ theme }) => ({
margin: 'auto 0', margin: 'auto 0',
@ -15,7 +13,7 @@ const StyledSingleValueChip = styled(Chip)(({ theme }) => ({
})); }));
interface ConstraintSingleValueProps { interface ConstraintSingleValueProps {
constraint: IConstraint | PlaygroundConstraintSchema; constraint: IConstraint;
allowExpand: (shouldExpand: boolean) => void; allowExpand: (shouldExpand: boolean) => void;
} }
@ -32,16 +30,6 @@ export const ConstraintAccordionViewHeaderSingleValue = ({
return ( return (
<div className={styles.headerValuesContainerWrapper}> <div className={styles.headerValuesContainerWrapper}>
<ConditionallyRender
condition={
'result' in constraint && !Boolean(constraint.result)
}
show={
<Typography variant={'body1'} color={'error'}>
does not match any values{' '}
</Typography>
}
/>
<StyledSingleValueChip <StyledSingleValueChip
label={formatConstraintValue(constraint, locationSettings)} label={formatConstraintValue(constraint, locationSettings)}
/> />