1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00

chore remove and clean some stuff (#9993)

- Deletes an unused file
- Fixes a console.error due to a prop being passed on to the HTML
component
- Puts all editable constraint files within a separate directory.
This commit is contained in:
Thomas Heartman 2025-05-15 09:23:33 +02:00 committed by GitHub
parent e9768f7363
commit a2723ec0c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 22 additions and 49 deletions

View File

@ -2,25 +2,25 @@ import { forwardRef } from 'react';
import type { ChipProps } from '@mui/material';
import { Chip, styled } from '@mui/material';
const StyledChip = styled(Chip)<{ multiline?: boolean }>(
({ theme, multiline }) => ({
borderRadius: `${theme.shape.borderRadius}px`,
padding: theme.spacing(0.25, 0),
fontSize: theme.fontSizes.smallerBody,
height: 'auto',
background: theme.palette.secondary.light,
border: `1px solid ${theme.palette.secondary.border}`,
color: theme.palette.secondary.dark,
fontWeight: theme.typography.fontWeightBold,
...(multiline
? {
'.MuiChip-label': {
whiteSpace: 'collapse',
},
}
: {}),
}),
);
const StyledChip = styled(Chip, {
shouldForwardProp: (prop) => prop !== 'multiline',
})<{ multiline?: boolean }>(({ theme, multiline }) => ({
borderRadius: `${theme.shape.borderRadius}px`,
padding: theme.spacing(0.25, 0),
fontSize: theme.fontSizes.smallerBody,
height: 'auto',
background: theme.palette.secondary.light,
border: `1px solid ${theme.palette.secondary.border}`,
color: theme.palette.secondary.dark,
fontWeight: theme.typography.fontWeightBold,
...(multiline
? {
'.MuiChip-label': {
whiteSpace: 'collapse',
},
}
: {}),
}));
export const StrategyEvaluationChip = forwardRef<
HTMLDivElement,

View File

@ -2,7 +2,7 @@ import { useState } from 'react';
import { Chip, styled } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import StringTruncator from 'component/common/StringTruncator/StringTruncator';
import { ConstraintValueSearch as NewConstraintValueSearch } from 'component/feature/FeatureStrategy/FeatureStrategyConstraints/ConstraintValueSearch';
import { ConstraintValueSearch as NewConstraintValueSearch } from 'component/feature/FeatureStrategy/FeatureStrategyConstraints/EditableConstraint/ConstraintValueSearch';
import { useUiFlag } from 'hooks/useUiFlag';
import { ConstraintValueSearch } from 'component/common/NewConstraintAccordion/ConstraintValueSearch/ConstraintValueSearch';

View File

@ -10,7 +10,7 @@ import {
createEmptyConstraint,
} from 'component/common/LegacyConstraintAccordion/ConstraintAccordionList/createEmptyConstraint';
import { ConstraintsList } from 'component/common/ConstraintsList/ConstraintsList';
import { EditableConstraint } from 'component/feature/FeatureStrategy/FeatureStrategyConstraints/EditableConstraint';
import { EditableConstraint } from 'component/feature/FeatureStrategy/FeatureStrategyConstraints/EditableConstraint/EditableConstraint';
export interface IEditableConstraintsListRef {
addConstraint?: (contextName: string) => void;
}

View File

@ -10,7 +10,7 @@ import { NewConstraintAccordion } from 'component/common/NewConstraintAccordion/
import { ConstraintsList } from 'component/common/ConstraintsList/ConstraintsList';
import { useUiFlag } from 'hooks/useUiFlag';
import { ConstraintAccordionView } from 'component/common/NewConstraintAccordion/ConstraintAccordionView/ConstraintAccordionView';
import { EditableConstraint } from 'component/feature/FeatureStrategy/FeatureStrategyConstraints/EditableConstraint';
import { EditableConstraint } from 'component/feature/FeatureStrategy/FeatureStrategyConstraints/EditableConstraint/EditableConstraint';
export interface IConstraintAccordionListProps {
constraints: IConstraint[];

View File

@ -1,27 +0,0 @@
import type {
IUnleashContextDefinition,
ILegalValue,
} from 'interfaces/context';
import type { IConstraint } from 'interfaces/strategy';
export const resolveLegalValues = (
values: IConstraint['values'] = [],
legalValues: IUnleashContextDefinition['legalValues'] = [],
): { legalValues: ILegalValue[]; deletedLegalValues: ILegalValue[] } => {
if (legalValues.length === 0) {
return {
legalValues: [],
deletedLegalValues: [],
};
}
const existingLegalValues = new Set(legalValues.map(({ value }) => value));
const deletedLegalValues = values
.filter((value) => !existingLegalValues.has(value))
.map((v) => ({ value: v, description: '' }));
return {
legalValues,
deletedLegalValues,
};
};