From f0201dac55f5ad4c8eff80e230bce09fdee71555 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Thu, 20 Mar 2025 11:29:03 +0100 Subject: [PATCH] cleanup dead code --- .../ConstraintsList/ConstraintsList.tsx | 2 +- .../NewConstraintAccordionList.tsx | 27 +------------------ .../ConstraintExecution.tsx | 21 ++++++++------- .../StrategyExecution/StrategyExecution.tsx | 15 ++++++++--- 4 files changed, 26 insertions(+), 39 deletions(-) diff --git a/frontend/src/component/common/ConstraintsList/ConstraintsList.tsx b/frontend/src/component/common/ConstraintsList/ConstraintsList.tsx index 0440457e92..46207fe392 100644 --- a/frontend/src/component/common/ConstraintsList/ConstraintsList.tsx +++ b/frontend/src/component/common/ConstraintsList/ConstraintsList.tsx @@ -18,7 +18,7 @@ export const ConstraintListItem = styled('div')(({ theme }) => ({ padding: theme.spacing(1.5, 3), display: 'flex', flexFlow: 'column', - gap: theme.spacing(2), + gap: theme.spacing(1), })); const StyledListItem = styled('li')({ diff --git a/frontend/src/component/common/NewConstraintAccordion/NewConstraintAccordionList/NewConstraintAccordionList.tsx b/frontend/src/component/common/NewConstraintAccordion/NewConstraintAccordionList/NewConstraintAccordionList.tsx index b348e9af38..4767309340 100644 --- a/frontend/src/component/common/NewConstraintAccordion/NewConstraintAccordionList/NewConstraintAccordionList.tsx +++ b/frontend/src/component/common/NewConstraintAccordion/NewConstraintAccordionList/NewConstraintAccordionList.tsx @@ -1,7 +1,6 @@ import type React from 'react'; import { forwardRef, Fragment, useImperativeHandle } from 'react'; -import { styled, Tooltip } from '@mui/material'; -import HelpOutline from '@mui/icons-material/HelpOutline'; +import { styled } from '@mui/material'; import type { IConstraint } from 'interfaces/strategy'; import produce from 'immer'; import useUnleashContext from 'hooks/api/getters/useUnleashContext/useUnleashContext'; @@ -43,30 +42,6 @@ const StyledContainer = styled('div')({ flexDirection: 'column', }); -const StyledHelpWrapper = styled(Tooltip)(({ theme }) => ({ - marginLeft: theme.spacing(0.75), - height: theme.spacing(1.5), -})); - -const StyledHelp = styled(HelpOutline)(({ theme }) => ({ - fill: theme.palette.action.active, - [theme.breakpoints.down(860)]: { - display: 'none', - }, -})); - -const StyledConstraintLabel = styled('p')(({ theme }) => ({ - marginBottom: theme.spacing(1), - color: theme.palette.text.secondary, -})); - -const StyledAddCustomLabel = styled('div')(({ theme }) => ({ - marginTop: theme.spacing(1), - marginBottom: theme.spacing(1), - color: theme.palette.text.primary, - display: 'flex', -})); - export const useConstraintAccordionList = ( setConstraints: | React.Dispatch> diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/ConstraintExecution/ConstraintExecution.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/ConstraintExecution/ConstraintExecution.tsx index fcb7227a40..6794989986 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/ConstraintExecution/ConstraintExecution.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/ConstraintExecution/ConstraintExecution.tsx @@ -7,6 +7,7 @@ import { ConstraintItemHeader } from 'component/common/ConstraintsList/Constrain import CheckCircle from '@mui/icons-material/CheckCircle'; import { styled } from '@mui/material'; import Cancel from '@mui/icons-material/Cancel'; +import { ConstraintListItem } from 'component/common/ConstraintsList/ConstraintsList'; interface IConstraintExecutionProps { constraint?: PlaygroundConstraintSchema; @@ -20,7 +21,7 @@ const StyledContainer = styled('div', { display: 'flex', alignItems: 'center', gap: theme.spacing(1), - paddingInline: theme.spacing(0.25), + padding: theme.spacing(0.5, 0.25), color: variant === 'ok' ? theme.palette.success.dark @@ -67,13 +68,15 @@ export const ConstraintExecution: FC = ({ }; return ( - <> - - {constraint.result ? ( - - ) : ( - - )} - + +
+ + {constraint.result ? ( + + ) : ( + + )} +
+
); }; diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/StrategyExecution.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/StrategyExecution.tsx index 9cd9235d8f..ac3ec80bf7 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/StrategyExecution.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureStrategyList/StrategyList/StrategyItem/StrategyExecution/StrategyExecution.tsx @@ -6,7 +6,10 @@ import { ConstraintExecution } from './ConstraintExecution/ConstraintExecution'; import { formattedStrategyNames } from 'utils/strategyNames'; import { StyledBoxSummary } from './StrategyExecution.styles'; import { Badge } from 'component/common/Badge/Badge'; -import { ConstraintsList } from 'component/common/ConstraintsList/ConstraintsList'; +import { + ConstraintListItem, + ConstraintsList, +} from 'component/common/ConstraintsList/ConstraintsList'; import { objectId } from 'utils/objectId'; import type { FC } from 'react'; import { SegmentExecution } from './SegmentExecution/SegmentExecution'; @@ -60,8 +63,14 @@ export const StrategyExecution: FC = ({ /> )) : []), - hasExecutionParameters && params, - isCustomStrategy && customStrategyItems, + hasExecutionParameters && + params.map((param, index) => ( + {param} + )), + isCustomStrategy && + customStrategyItems.map((param, index) => ( + {param} + )), name === 'default' && ( The standard strategy is ON for