Skip to content

Commit 7963184

Browse files
committed
chore: add dummy conditions for upsell
1 parent 11ee73a commit 7963184

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

js/Conditions/ConditionsControl.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ const ConditionsControl = ({
113113
if ( field.unsupportedOperators?.includes( conditionsCopy[index].operator ) ) {
114114
conditionsCopy[index].operator = Object.keys( window?.feedzyConditionsData?.operators ).filter( key => ! field.unsupportedOperators?.includes( key ) )[0];
115115
}
116+
117+
conditionsCopy[index].value = '';
116118
}
117119

118120
setConditions( {
@@ -128,11 +130,11 @@ const ConditionsControl = ({
128130
value={ conditions.match }
129131
options={ [
130132
{
131-
label: __( 'All', 'feedzy-rss-feeds' ),
133+
label: __( 'All conditions are true', 'feedzy-rss-feeds' ),
132134
value: 'all'
133135
},
134136
{
135-
label: __( 'Any', 'feedzy-rss-feeds' ),
137+
label: __( 'Any condition is true', 'feedzy-rss-feeds' ),
136138
value: 'any'
137139
}
138140
] }
@@ -148,6 +150,7 @@ const ConditionsControl = ({
148150
key={ index }
149151
label={ `${ field?.label } ${ window.feedzyConditionsData.operators[condition.operator] } ${ condition?.value || '' }` }
150152
onDelete={ () => removeCondition( index ) }
153+
initialOpen={ index === 0 }
151154
>
152155
<SelectControl
153156
label={ __( 'Field', 'feedzy-rss-feeds' ) }

js/Conditions/PanelTab.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import { useState } from '@wordpress/element';
1010
const PanelTab = ({
1111
label,
1212
onDelete,
13+
initialOpen = false,
1314
children
1415
}) => {
15-
const [ isOpen, setOpen ] = useState( false );
16+
const [ isOpen, setOpen ] = useState( initialOpen );
1617

1718
return (
1819
<div className="fz-panel-tab">

js/Conditions/conditions.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ import {
1616
*/
1717
import ConditionsControl from './ConditionsControl';
1818

19+
const dummyConditions = {
20+
match: 'all',
21+
conditions: [
22+
{
23+
field: 'title',
24+
operator: 'contains',
25+
value: 'Sports'
26+
}
27+
]
28+
};
29+
1930
const App = () => {
2031
const [ conditions, setConditions ] = useState( {
2132
conditions: [],
@@ -39,7 +50,7 @@ const App = () => {
3950
return (
4051
<Disabled>
4152
<ConditionsControl
42-
conditions={ conditions }
53+
conditions={ dummyConditions }
4354
setConditions={ setConditions }
4455
/>
4556
</Disabled>

0 commit comments

Comments
 (0)