Skip to content

Commit f9f40e9

Browse files
authored
chore: show no segment rules validation (#3612)
1 parent 8e7b513 commit f9f40e9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

frontend/web/components/modals/CreateSegment.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ const CreateSegment: FC<CreateSegmentType> = ({
259259
}
260260
return warnings
261261
}, [operators, rules])
262+
//Find any non-deleted rules
263+
const hasNoRules = !rules[0]?.rules?.find((v) => !v.delete)
264+
262265
const rulesEl = (
263266
<div className='overflow-visible'>
264267
<div>
@@ -296,6 +299,11 @@ const CreateSegment: FC<CreateSegmentType> = ({
296299
)
297300
})}
298301
</div>
302+
{hasNoRules && (
303+
<InfoMessage>
304+
Add at least one AND/NOT rule to create a segment.
305+
</InfoMessage>
306+
)}
299307
<Row className='justify-content-end'>
300308
{!readOnly && (
301309
<div onClick={() => addRule('ANY')} className='text-center'>

0 commit comments

Comments
 (0)