From 1258e18638e43ae8d8e1ad29eb360d5cc91cb50e Mon Sep 17 00:00:00 2001 From: kyle-ssg Date: Wed, 10 Jan 2024 14:58:36 +0000 Subject: [PATCH 1/3] Adjust segment not rule --- frontend/web/components/modals/CreateSegment.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/web/components/modals/CreateSegment.tsx b/frontend/web/components/modals/CreateSegment.tsx index 029770232d2d..5892eeb383ad 100644 --- a/frontend/web/components/modals/CreateSegment.tsx +++ b/frontend/web/components/modals/CreateSegment.tsx @@ -303,7 +303,7 @@ const CreateSegment: FC = ({ )} {!readOnly && Utils.getFlagsmithHasFeature('not_operator') && ( -
addRule('NOT')} className='text-center'> +
addRule('NONE')} className='text-center'> {Utils.getFlagsmithValue('not_operator') ? ( Date: Wed, 10 Jan 2024 15:56:37 +0000 Subject: [PATCH 2/3] Adjust segment not rule --- frontend/e2e/helpers.cafe.ts | 1 + .../web/components/modals/CreateSegment.tsx | 68 +++++++------------ frontend/web/styles/project/_forms.scss | 1 - 3 files changed, 27 insertions(+), 43 deletions(-) diff --git a/frontend/e2e/helpers.cafe.ts b/frontend/e2e/helpers.cafe.ts index 041af36818cb..bc1fdbfa55a9 100644 --- a/frontend/e2e/helpers.cafe.ts +++ b/frontend/e2e/helpers.cafe.ts @@ -340,6 +340,7 @@ export const createSegment = async ( rules?: Rule[], ) => { await click(byId('show-create-segment-btn')) + await click(byId('add-rule')) await setText(byId('segmentID'), id) for (let x = 0; x < rules.length; x++) { const rule = rules[x] diff --git a/frontend/web/components/modals/CreateSegment.tsx b/frontend/web/components/modals/CreateSegment.tsx index 5892eeb383ad..09c33589eeb6 100644 --- a/frontend/web/components/modals/CreateSegment.tsx +++ b/frontend/web/components/modals/CreateSegment.tsx @@ -38,6 +38,7 @@ import ErrorMessage from 'components/ErrorMessage' import ProjectStore from 'common/stores/project-store' import Icon from 'components/Icon' import Permission from 'common/providers/Permission' +import classNames from 'classnames' type PageType = { number: number @@ -99,13 +100,7 @@ const CreateSegment: FC = ({ rules: [ { conditions: [], - rules: [ - { - conditions: [{ ...Constants.defaultRule }], - rules: [], - type: 'ANY', - }, - ], + rules: [], type: 'ALL', }, ], @@ -274,13 +269,21 @@ const CreateSegment: FC = ({ } return (
- {i > 0 && ( - - - {rule.type === 'ANY' ? 'AND' : 'AND NOT'} - - - )} + + + {Format.camelCase( + `${i > 0 ? 'And ' : ''}${ + rule.type === 'ANY' + ? 'Any of the following' + : 'None of the following' + }`, + )} + + = ({ )} {!readOnly && Utils.getFlagsmithHasFeature('not_operator') && (
addRule('NONE')} className='text-center'> - {Utils.getFlagsmithValue('not_operator') ? ( - - Add AND NOT Condition - - } - > - {`Note: If using clientside evaluations on your SDK, this feature is only supported by the following SDKs: ${JSON.parse( - Utils.getFlagsmithValue('not_operator'), - )}`} - - ) : ( - - )} +
)} @@ -419,7 +403,7 @@ const CreateSegment: FC = ({ Note: Trait names are case sensitive diff --git a/frontend/web/styles/project/_forms.scss b/frontend/web/styles/project/_forms.scss index 0483c18579a8..6cbbd8109a94 100644 --- a/frontend/web/styles/project/_forms.scss +++ b/frontend/web/styles/project/_forms.scss @@ -25,7 +25,6 @@ } .and-divider { color: $text-icon-light-grey; - text-transform: uppercase; font-weight: 400; font-size: $font-caption; line-height: $line-height-xsm; From 54617d9eb518aa20162896a058b89e1d054afdda Mon Sep 17 00:00:00 2001 From: kyle-ssg Date: Thu, 11 Jan 2024 10:19:29 +0000 Subject: [PATCH 3/3] Fix incorrect "AND" wording when deleting rules --- .../web/components/modals/CreateSegment.tsx | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/frontend/web/components/modals/CreateSegment.tsx b/frontend/web/components/modals/CreateSegment.tsx index 09c33589eeb6..8ea9c7cd1dc9 100644 --- a/frontend/web/components/modals/CreateSegment.tsx +++ b/frontend/web/components/modals/CreateSegment.tsx @@ -263,39 +263,38 @@ const CreateSegment: FC = ({
- {rules[0].rules.map((rule, i) => { - if (rule.delete) { - return null - } - return ( -
- - - {Format.camelCase( - `${i > 0 ? 'And ' : ''}${ - rule.type === 'ANY' - ? 'Any of the following' - : 'None of the following' - }`, - )} - - - removeRule(0, i)} - onChange={(v: SegmentRule) => updateRule(0, i, v)} - /> -
- ) - })} + {rules[0].rules + ?.filter((v) => !v?.delete) + .map((rule, i) => { + return ( +
+ + + {Format.camelCase( + `${i > 0 ? 'And ' : ''}${ + rule.type === 'ANY' + ? 'Any of the following' + : 'None of the following' + }`, + )} + + + removeRule(0, i)} + onChange={(v: SegmentRule) => updateRule(0, i, v)} + /> +
+ ) + })}
{!readOnly && (