File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ const ConditionsControl = ({
113
113
if ( field . unsupportedOperators ?. includes ( conditionsCopy [ index ] . operator ) ) {
114
114
conditionsCopy [ index ] . operator = Object . keys ( window ?. feedzyConditionsData ?. operators ) . filter ( key => ! field . unsupportedOperators ?. includes ( key ) ) [ 0 ] ;
115
115
}
116
+
117
+ conditionsCopy [ index ] . value = '' ;
116
118
}
117
119
118
120
setConditions ( {
@@ -128,11 +130,11 @@ const ConditionsControl = ({
128
130
value = { conditions . match }
129
131
options = { [
130
132
{
131
- label : __ ( 'All' , 'feedzy-rss-feeds' ) ,
133
+ label : __ ( 'All conditions are true ' , 'feedzy-rss-feeds' ) ,
132
134
value : 'all'
133
135
} ,
134
136
{
135
- label : __ ( 'Any' , 'feedzy-rss-feeds' ) ,
137
+ label : __ ( 'Any condition is true ' , 'feedzy-rss-feeds' ) ,
136
138
value : 'any'
137
139
}
138
140
] }
@@ -148,6 +150,7 @@ const ConditionsControl = ({
148
150
key = { index }
149
151
label = { `${ field ?. label } ${ window . feedzyConditionsData . operators [ condition . operator ] } ${ condition ?. value || '' } ` }
150
152
onDelete = { ( ) => removeCondition ( index ) }
153
+ initialOpen = { index === 0 }
151
154
>
152
155
< SelectControl
153
156
label = { __ ( 'Field' , 'feedzy-rss-feeds' ) }
Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ import { useState } from '@wordpress/element';
10
10
const PanelTab = ( {
11
11
label,
12
12
onDelete,
13
+ initialOpen = false ,
13
14
children
14
15
} ) => {
15
- const [ isOpen , setOpen ] = useState ( false ) ;
16
+ const [ isOpen , setOpen ] = useState ( initialOpen ) ;
16
17
17
18
return (
18
19
< div className = "fz-panel-tab" >
Original file line number Diff line number Diff line change @@ -16,6 +16,17 @@ import {
16
16
*/
17
17
import ConditionsControl from './ConditionsControl' ;
18
18
19
+ const dummyConditions = {
20
+ match : 'all' ,
21
+ conditions : [
22
+ {
23
+ field : 'title' ,
24
+ operator : 'contains' ,
25
+ value : 'Sports'
26
+ }
27
+ ]
28
+ } ;
29
+
19
30
const App = ( ) => {
20
31
const [ conditions , setConditions ] = useState ( {
21
32
conditions : [ ] ,
@@ -39,7 +50,7 @@ const App = () => {
39
50
return (
40
51
< Disabled >
41
52
< ConditionsControl
42
- conditions = { conditions }
53
+ conditions = { dummyConditions }
43
54
setConditions = { setConditions }
44
55
/>
45
56
</ Disabled >
You can’t perform that action at this time.
0 commit comments