(props: IProps)
| 24 | } |
| 25 | |
| 26 | const RuleContent = (props: IProps) => { |
| 27 | const { |
| 28 | rule, |
| 29 | disabled, |
| 30 | ruleIndex, |
| 31 | useSegment, |
| 32 | ruleContainer, |
| 33 | subjectOptions, |
| 34 | segmentContainer, |
| 35 | variationContainer, |
| 36 | hooksFormContainer, |
| 37 | } = props; |
| 38 | |
| 39 | const intl = useIntl(); |
| 40 | const { registerErrorName } = useFormErrorScrollIntoView(); |
| 41 | |
| 42 | const { |
| 43 | formState: { errors }, |
| 44 | } = hooksFormContainer.useContainer(); |
| 45 | |
| 46 | let variations; |
| 47 | |
| 48 | if (variationContainer) { |
| 49 | variations = variationContainer.useContainer().variations; |
| 50 | } |
| 51 | |
| 52 | const { |
| 53 | handleAddCondition, |
| 54 | handleChangeServe, |
| 55 | } = ruleContainer.useContainer(); |
| 56 | |
| 57 | const ruleAddCls = classNames( |
| 58 | { |
| 59 | [styles['rule-add']]: rule.conditions.length > 0 |
| 60 | }, |
| 61 | { |
| 62 | [styles['rule-add-one']]: rule.conditions.length === 0 |
| 63 | } |
| 64 | ); |
| 65 | |
| 66 | const btnCls = classNames( |
| 67 | { |
| 68 | [styles['rule-add-btn']]: true |
| 69 | }, |
| 70 | { |
| 71 | [styles['rule-add-btn-error']]: !!errors[`rule_${rule.id}_add`] |
| 72 | } |
| 73 | ); |
| 74 | |
| 75 | return ( |
| 76 | <div className={styles['rule-content']}> |
| 77 | { |
| 78 | rule.conditions?.map((condition: ICondition, index: number) => { |
| 79 | return ( |
| 80 | <Condition |
| 81 | key={condition.id} |
| 82 | rule={rule} |
| 83 | disabled={disabled} |
nothing calls this directly
no test coverage detected