diff --git a/frontend/src/component/common/ConstraintsList/StrategyEvaluationItem/StrategyEvaluationItem.tsx b/frontend/src/component/common/ConstraintsList/StrategyEvaluationItem/StrategyEvaluationItem.tsx index 5f26e7e4a6..713cf7d499 100644 --- a/frontend/src/component/common/ConstraintsList/StrategyEvaluationItem/StrategyEvaluationItem.tsx +++ b/frontend/src/component/common/ConstraintsList/StrategyEvaluationItem/StrategyEvaluationItem.tsx @@ -1,4 +1,5 @@ -import { Chip, type ChipProps, styled } from '@mui/material'; +import { styled } from '@mui/material'; +import { disabledStrategyClassName } from 'component/common/StrategyItemContainer/disabled-strategy-utils'; import type { FC, ReactNode } from 'react'; type StrategyItemProps = { @@ -19,6 +20,10 @@ const StyledContent = styled('div')(({ theme }) => ({ gap: theme.spacing(1), flexWrap: 'wrap', alignItems: 'center', + [`.${disabledStrategyClassName} &`]: { + filter: 'grayscale(1)', + color: theme.palette.text.secondary, + }, })); const StyledType = styled('span')(({ theme }) => ({ @@ -30,17 +35,23 @@ const StyledType = styled('span')(({ theme }) => ({ width: theme.spacing(10), })); -const StyledValuesGroup = styled('div')(({ theme }) => ({ +const StyledValuesGroup = styled('ul')(({ theme }) => ({ display: 'flex', + flexFlow: 'row wrap', alignItems: 'center', gap: theme.spacing(0.5), + listStyle: 'none', + padding: 0, })); -const StyledValue = styled(({ ...props }: ChipProps) => ( - -))(({ theme }) => ({ - padding: theme.spacing(0.5), - background: theme.palette.background.elevation1, +const StyledValue = styled('li')(({ theme }) => ({ + [`.${disabledStrategyClassName} &`]: { + filter: 'grayscale(1)', + color: theme.palette.text.secondary, + }, + ':not(&:last-of-type)::after': { + content: '", "', + }, })); /** @@ -58,7 +69,9 @@ export const StrategyEvaluationItem: FC = ({ {values && values?.length > 0 ? ( {values?.map((value, index) => ( - + + {value} + ))} ) : null} diff --git a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx index d1018c2d03..c008fd69ee 100644 --- a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx +++ b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx @@ -8,6 +8,7 @@ import type { PlaygroundStrategySchema } from 'openapi'; import { Badge } from '../Badge/Badge'; import { Link } from 'react-router-dom'; import { Truncator } from '../Truncator/Truncator'; +import { disabledStrategyClassName } from './disabled-strategy-utils'; type StrategyItemContainerProps = { strategyHeaderLevel?: 1 | 2 | 3 | 4 | 5 | 6; @@ -87,7 +88,10 @@ export const StrategyItemContainer: FC = ({ : ({ children }) => <> {children} ; return ( - + {onDragStart ? ( @@ -136,9 +140,6 @@ export const StrategyItemContainer: FC = ({ - {strategy.disabled ? ( - Disabled - ) : null} {headerItemsLeft} = ({ alignItems: 'center', }} > + {strategy.disabled ? ( + Strategy disabled + ) : null} {headerItemsRight} diff --git a/frontend/src/component/common/StrategyItemContainer/disabled-strategy-utils.ts b/frontend/src/component/common/StrategyItemContainer/disabled-strategy-utils.ts new file mode 100644 index 0000000000..d1d857d26d --- /dev/null +++ b/frontend/src/component/common/StrategyItemContainer/disabled-strategy-utils.ts @@ -0,0 +1,2 @@ +export const disabledStrategyClassName = + 'disabled-strategy-55d37c31-ca3f-4c19-bf86-9158824899bf'; diff --git a/frontend/src/component/common/StrategySeparator/StrategySeparator.tsx b/frontend/src/component/common/StrategySeparator/StrategySeparator.tsx index b73c7b840c..682c9443e2 100644 --- a/frontend/src/component/common/StrategySeparator/StrategySeparator.tsx +++ b/frontend/src/component/common/StrategySeparator/StrategySeparator.tsx @@ -13,6 +13,10 @@ const Chip = styled('div')(({ theme }) => ({ left: theme.spacing(4), })); -export const StrategySeparator = () => { - return OR; +export const StrategySeparator = ({ className }: { className?: string }) => { + return ( + + OR + + ); }; diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/EnvironmentAccordionBody.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/EnvironmentAccordionBody.tsx index 6d16d97818..eb7a5e7e1f 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/EnvironmentAccordionBody.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/EnvironmentAccordionBody.tsx @@ -22,6 +22,7 @@ import { useReleasePlans } from 'hooks/api/getters/useReleasePlans/useReleasePla import { ReleasePlan } from '../../../ReleasePlan/ReleasePlan'; import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator'; import { ProjectEnvironmentStrategyDraggableItem } from './StrategyDraggableItem/ProjectEnvironmentStrategyDraggableItem'; +import { disabledStrategyClassName } from 'component/common/StrategyItemContainer/disabled-strategy-utils'; interface IEnvironmentAccordionBodyProps { isDisabled: boolean; @@ -77,6 +78,13 @@ const StyledAlert = styled(Alert)(({ theme }) => ({ marginInline: theme.spacing(2), // should consider finding a variable here })); +const StyledStrategySeparator = styled(StrategySeparator)(({ theme }) => ({ + [`&:has(+ *:not(ol) .${disabledStrategyClassName}), &:has(+ ol > li:first-of-type .${disabledStrategyClassName})`]: + { + filter: 'grayscale(1)', + }, +})); + export const EnvironmentAccordionBody = ({ featureEnvironment, isDisabled, @@ -243,7 +251,7 @@ export const EnvironmentAccordionBody = ({ {strategies.map((strategy, index) => ( - {index > 0 ? : null} + {index > 0 ? : null} {page.map((strategy, index) => ( - {index > 0 ? : null} + {index > 0 ? : null} 0 ? (
  • - + {strategyList}
  • ) : null} diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/ProjectEnvironmentStrategyDraggableItem.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/ProjectEnvironmentStrategyDraggableItem.tsx index 49dad7698a..19de8335cf 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/ProjectEnvironmentStrategyDraggableItem.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/ProjectEnvironmentStrategyDraggableItem.tsx @@ -17,6 +17,7 @@ import { UPDATE_FEATURE_STRATEGY } from '@server/types/permissions'; import { StrategyDraggableItem } from './StrategyDraggableItem'; type ProjectEnvironmentStrategyDraggableItemProps = { + className?: string; strategy: IFeatureStrategy; environmentName: string; index: number; @@ -36,6 +37,7 @@ type ProjectEnvironmentStrategyDraggableItemProps = { const onDragNoOp = () => () => {}; export const ProjectEnvironmentStrategyDraggableItem = ({ + className, strategy, index, environmentName, @@ -74,6 +76,7 @@ export const ProjectEnvironmentStrategyDraggableItem = ({ return ( prop !== 'grayscale', -})<{ grayscale: boolean }>(({ grayscale }) => - grayscale ? { filter: 'grayscale(1)', opacity: 0.67 } : {}, -); - type StrategyExecutionProps = { strategy: IFeatureStrategyPayload | FeatureStrategySchema; displayGroupId?: boolean; @@ -52,19 +45,17 @@ export const StrategyExecution: FC = ({ } return ( - - - {strategySegments?.map((segment) => ( - - ))} - {constraints?.map((constraint, index) => ( - - ))} - {isCustomStrategy ? customStrategyItems : strategyParameters} - - + + {strategySegments?.map((segment) => ( + + ))} + {constraints?.map((constraint, index) => ( + + ))} + {isCustomStrategy ? customStrategyItems : strategyParameters} + ); };