1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-04 13:48:56 +02:00

more files deletion

This commit is contained in:
Thomas Heartman 2025-06-10 13:22:45 +02:00
parent 6c14a3384e
commit 04074928ca
3 changed files with 0 additions and 148 deletions

View File

@ -1,72 +0,0 @@
import type { IConstraint } from 'interfaces/strategy';
import { ConditionallyRender } from '../../../ConditionallyRender/ConditionallyRender.tsx';
import { Tooltip, Box, styled } from '@mui/material';
import { stringOperators } from 'constants/operators';
import { ReactComponent as NegatedOnIcon } from 'assets/icons/not_operator_selected.svg';
import { ConstraintOperator } from '../../ConstraintOperator/ConstraintOperator.tsx';
import { StyledIconWrapper } from './StyledIconWrapper.tsx';
import { ReactComponent as CaseSensitive } from 'assets/icons/24_Text format.svg';
import { oneOf } from 'utils/oneOf';
import { useTheme } from '@mui/material';
interface ConstraintViewHeaderOperatorProps {
constraint: IConstraint;
disabled?: boolean;
}
const StyledHeaderValuesContainerWrapper = styled('div')(({ theme }) => ({
display: 'flex',
alignItems: 'stretch',
margin: 'auto 0',
}));
const StyledHeaderConstraintContainer = styled('div')(({ theme }) => ({
minWidth: '152px',
position: 'relative',
[theme.breakpoints.down('sm')]: {
paddingRight: 0,
},
}));
export const ConstraintViewHeaderOperator = ({
constraint,
disabled = false,
}: ConstraintViewHeaderOperatorProps) => {
const theme = useTheme();
return (
<StyledHeaderValuesContainerWrapper>
<ConditionallyRender
condition={Boolean(constraint.inverted)}
show={
<Tooltip title={'Operator is negated'} arrow>
<Box sx={{ display: 'flex' }}>
<StyledIconWrapper isPrefix>
<NegatedOnIcon />
</StyledIconWrapper>
</Box>
</Tooltip>
}
/>
<StyledHeaderConstraintContainer>
<ConstraintOperator
constraint={constraint}
hasPrefix={Boolean(constraint.inverted)}
disabled={disabled}
/>
</StyledHeaderConstraintContainer>
<ConditionallyRender
condition={
!constraint.caseInsensitive &&
oneOf(stringOperators, constraint.operator)
}
show={
<Tooltip title='Case sensitive is active' arrow>
<StyledIconWrapper>
<CaseSensitive />
</StyledIconWrapper>
</Tooltip>
}
/>
</StyledHeaderValuesContainerWrapper>
);
};

View File

@ -1,53 +0,0 @@
import type { IConstraint } from 'interfaces/strategy';
import { formatOperatorDescription } from 'component/common/LegacyConstraintAccordion/ConstraintOperator/formatOperatorDescription';
import { styled } from '@mui/material';
interface IConstraintOperatorProps {
constraint: IConstraint;
hasPrefix?: boolean;
disabled?: boolean;
}
const StyledContainer = styled('div')(({ theme }) => ({
padding: theme.spacing(0.5, 1.5),
borderRadius: theme.shape.borderRadius,
backgroundColor: theme.palette.background.elevation2,
lineHeight: 1.25,
}));
const StyledName = styled('p', {
shouldForwardProp: (prop) => prop !== 'disabled',
})<{ disabled: boolean }>(({ theme, disabled }) => ({
fontSize: theme.fontSizes.smallBody,
lineHeight: 17 / 14,
color: disabled ? theme.palette.text.secondary : theme.palette.text.primary,
}));
const StyledText = styled('p', {
shouldForwardProp: (prop) => prop !== 'disabled',
})<{ disabled: boolean }>(({ theme, disabled }) => ({
fontSize: theme.fontSizes.smallerBody,
color: disabled ? theme.palette.text.secondary : theme.palette.neutral.main,
}));
export const ConstraintOperator = ({
constraint,
hasPrefix,
disabled = false,
}: IConstraintOperatorProps) => {
const operatorName = constraint.operator;
const operatorText = formatOperatorDescription(constraint.operator);
return (
<StyledContainer
style={{
borderTopLeftRadius: hasPrefix ? 0 : undefined,
borderBottomLeftRadius: hasPrefix ? 0 : undefined,
paddingLeft: hasPrefix ? 0 : undefined,
}}
>
<StyledName disabled={disabled}>{operatorName}</StyledName>
<StyledText disabled={disabled}>{operatorText}</StyledText>
</StyledContainer>
);
};

View File

@ -1,23 +0,0 @@
import type { Operator } from 'constants/operators';
export const formatOperatorDescription = (operator: Operator): string => {
return constraintOperatorDescriptions[operator];
};
const constraintOperatorDescriptions = {
IN: 'is one of',
NOT_IN: 'is not one of',
STR_CONTAINS: 'is a string that contains',
STR_STARTS_WITH: 'is a string that starts with',
STR_ENDS_WITH: 'is a string that ends with',
NUM_EQ: 'is a number equal to',
NUM_GT: 'is a number greater than',
NUM_GTE: 'is a number greater than or equal to',
NUM_LT: 'is a number less than',
NUM_LTE: 'is a number less than or equal to',
DATE_BEFORE: 'is a date before',
DATE_AFTER: 'is a date after',
SEMVER_EQ: 'is a SemVer equal to',
SEMVER_GT: 'is a SemVer greater than',
SEMVER_LT: 'is a SemVer less than',
};