From e432ae45e0c92f383c6f4a24adc74f04c7c89bd9 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech Date: Mon, 8 Aug 2022 09:50:49 +0200 Subject: [PATCH] update strategy border for playground --- .../StrategyItemContainer.styles.ts | 2 + .../StrategyItemContainer.tsx | 7 +- .../FeatureResultInfoPopoverCell.styles.ts | 8 +- .../PlaygroundResultFeatureStrategyList.tsx | 49 ++++----- ...ygroundResultFeatureStrategyItem.styles.ts | 3 + .../PlaygroundResultFeatureStrategyItem.tsx | 100 +++++------------- .../playgroundResultStrategyLists.tsx | 57 +++++----- 7 files changed, 98 insertions(+), 128 deletions(-) diff --git a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.styles.ts b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.styles.ts index f0c781ad0d..a196ad6052 100644 --- a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.styles.ts +++ b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.styles.ts @@ -26,6 +26,8 @@ export const useStyles = makeStyles()(theme => ({ actions: { marginLeft: 'auto', display: 'flex', + minHeight: theme.spacing(6), + alignItems: 'center', }, resultChip: { marginLeft: 'auto', diff --git a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx index 8d6ca0d7a7..fc3efe8e61 100644 --- a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx +++ b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx @@ -17,6 +17,7 @@ interface IStrategyItemContainerProps { onDragEnd?: DragEventHandler; actions?: ReactNode; orderNumber?: number; + className?: string; } const DragIcon = styled(IconButton)(({ theme }) => ({ @@ -44,6 +45,7 @@ export const StrategyItemContainer: FC = ({ actions, children, orderNumber, + className, }) => { const { classes: styles } = useStyles(); const Icon = getFeatureStrategyIcon(strategy.name); @@ -54,8 +56,7 @@ export const StrategyItemContainer: FC = ({ condition={orderNumber !== undefined} show={{orderNumber}} /> - -
+
= ({
{actions}
{children}
-
+ ); }; diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureResultInfoPopoverCell.styles.ts b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureResultInfoPopoverCell.styles.ts index 7ca759f769..ecbfd67489 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureResultInfoPopoverCell.styles.ts +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/FeatureResultInfoPopoverCell.styles.ts @@ -4,11 +4,13 @@ export const useStyles = makeStyles()(theme => ({ popoverPaper: { display: 'flex', flexDirection: 'column', - alignItems: 'flex-start', + // alignItems: 'flex-start', padding: theme.spacing(6), - maxWidth: '728px', + // maxWidth: '728px', + width: 728, + maxWidth: '100%', height: 'auto', - overflowY: 'scroll', + overflowY: 'auto', backgroundColor: theme.palette.tertiary.light, }, })); diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultFeatureStrategyList.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultFeatureStrategyList.tsx index 5941210c61..00d93fb271 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultFeatureStrategyList.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultFeatureStrategyList.tsx @@ -1,13 +1,10 @@ -import { - PlaygroundResultStrategyLists, - WrappedPlaygroundResultStrategyList, -} from './PlaygroundResultStrategyList/playgroundResultStrategyLists'; -import { ConditionallyRender } from '../../../../../common/ConditionallyRender/ConditionallyRender'; -import React from 'react'; +import { PlaygroundResultStrategyLists } from './PlaygroundResultStrategyList/playgroundResultStrategyLists'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { PlaygroundFeatureSchema, PlaygroundRequestSchema, -} from '../../../../../../hooks/api/actions/usePlayground/playground.model'; +} from 'hooks/api/actions/usePlayground/playground.model'; +import { Alert } from '@mui/material'; interface PlaygroundResultFeatureStrategyListProps { feature: PlaygroundFeatureSchema; @@ -19,24 +16,24 @@ export const PlaygroundResultFeatureStrategyList = ({ input, }: PlaygroundResultFeatureStrategyListProps) => { return ( - - } - elseShow={ - - } - /> + <> + + If environment would be enabled then this feature would + be {feature.strategies.result ? 'TRUE' : 'FALSE'} and + the strategies would evaluate like this:{' '} + + } + /> + + ); }; diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.styles.ts b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.styles.ts index 60369dd079..a6721ebb07 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.styles.ts +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.styles.ts @@ -34,4 +34,7 @@ export const useStyles = makeStyles()(theme => ({ borderRadius: theme.shape.borderRadiusMedium, background: theme.palette.background.default, }, + successBorder: { + border: `1px solid ${theme.palette.success.main}`, + }, })); diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx index 24ecf11045..bb4f4cb8cf 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx @@ -1,11 +1,4 @@ -import { Box, styled, Typography, useTheme } from '@mui/material'; -import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; -import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator'; -import { - formatStrategyName, - getFeatureStrategyIcon, -} from 'utils/strategyNames'; -import StringTruncator from 'component/common/StringTruncator/StringTruncator'; +import { useTheme } from '@mui/material'; import { PlaygroundResultChip } from '../../../../PlaygroundResultChip/PlaygroundResultChip'; import { PlaygroundStrategySchema, @@ -13,6 +6,8 @@ import { } from 'hooks/api/actions/usePlayground/playground.model'; import { PlaygroundResultStrategyExecution } from './PlaygroundResultStrategyExecution/PlaygroundResultStrategyExecution'; import { useStyles } from './PlaygroundResultFeatureStrategyItem.styles'; +import { StrategyItemContainer } from 'component/common/StrategyItemContainer/StrategyItemContainer'; +import { objectId } from 'utils/objectId'; interface IPlaygroundResultFeatureStrategyItemProps { strategy: PlaygroundStrategySchema; @@ -21,86 +16,49 @@ interface IPlaygroundResultFeatureStrategyItemProps { compact: boolean; } -const StyledItemWrapper = styled('div')(({ theme }) => ({ - display: 'flex', - flexDirection: 'row', - alignItems: 'center', - margin: theme.spacing(0.5, 0), - gap: theme.spacing(1), -})); - export const PlaygroundResultFeatureStrategyItem = ({ strategy, input, index, compact, }: IPlaygroundResultFeatureStrategyItemProps) => { - const { result, name } = strategy; + const { result } = strategy; const { classes: styles } = useStyles(); const theme = useTheme(); - const Icon = getFeatureStrategyIcon(strategy.name); const label = result.evaluationStatus === 'incomplete' ? 'Unevaluated' : result.enabled ? 'True' : 'False'; - const border = - result.enabled && result.evaluationStatus === 'complete' - ? `1px solid ${theme.palette.success.main}` - : `1px solid ${theme.palette.divider}`; return ( - + } > - 0} - show={} + - - - {index + 1} - - -
-
- - -
- -
-
- -
-
-
-
+ ); }; diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/playgroundResultStrategyLists.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/playgroundResultStrategyLists.tsx index b3913b2210..c3deacddb3 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/playgroundResultStrategyLists.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/playgroundResultStrategyLists.tsx @@ -1,11 +1,12 @@ +import { Alert, Box, styled, Typography } from '@mui/material'; import { PlaygroundFeatureSchema, PlaygroundStrategySchema, PlaygroundRequestSchema, -} from '../../../../../../../hooks/api/actions/usePlayground/playground.model'; -import { ConditionallyRender } from '../../../../../../common/ConditionallyRender/ConditionallyRender'; -import { Alert, styled, Typography } from '@mui/material'; +} from 'hooks/api/actions/usePlayground/playground.model'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { PlaygroundResultFeatureStrategyItem } from './PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem'; +import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator'; const StyledAlertWrapper = styled('div')(({ theme }) => ({ display: 'flex', @@ -34,30 +35,36 @@ export const PlaygroundResultStrategyLists = ({ strategies, input, compact = false, -}: PlaygroundResultStrategyListProps) => { - return ( - 0} - show={ - <> - {`Strategies (${strategies.length})`} +}: PlaygroundResultStrategyListProps) => ( + 0} + show={ + <> + {`Strategies (${strategies.length})`} + {strategies.map((strategy, index) => ( - + <> + 0} + show={} + /> + + ))} - - } - /> - ); -}; + + + } + /> +); interface WrappedPlaygroundResultStrategyListProps extends PlaygroundResultStrategyListProps {