Skip to content

Commit 1c9b0f5

Browse files
committed
Fix console warnings raised due to wp 6.7
1 parent 9aec58f commit 1c9b0f5

22 files changed

+69
-24
lines changed

src/js/components/user-selector.js

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export const UserSelector = ( { value, onChange } ) => {
125125
remove: __( 'Remove user', 'classifai' ),
126126
__experimentalInvalid: __( 'Invalid user', 'classifai' ),
127127
} }
128+
__nextHasNoMarginBottom
128129
/>
129130
);
130131
};

src/js/settings/components/allowed-roles/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const AllowedRoles = () => {
5353
},
5454
} );
5555
} }
56+
__nextHasNoMarginBottom
5657
/>
5758
);
5859
} ) }

src/js/settings/components/feature-additional-settings/classification-previewers/openai-embedding.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function AzureOpenAIEmbeddingsResults( { postId } ) {
8686
}, [ postId ] );
8787

8888
const card = Object.keys( responseData ).map( ( taxSlug ) => {
89-
const tags = responseData[ taxSlug ].data.map( ( tag, _index ) => {
89+
const tags = responseData[ taxSlug ]?.data.map( ( tag, _index ) => {
9090
const threshold = settings[ `${ taxSlug }_threshold` ];
9191
const score = normalizeScore( tag.score );
9292

src/js/settings/components/feature-additional-settings/classification.js

+34-22
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,44 @@ const ClassificationMethodSettings = () => {
4545
);
4646
const { setFeatureSettings } = useDispatch( STORE_NAME );
4747

48-
const classifaicationMethodOptions = [
49-
{
48+
const classifaicationMethodOptions = [];
49+
if ( featureSettings.provider === 'ibm_watson_nlu' ) {
50+
classifaicationMethodOptions.push( {
5051
label: __(
5152
'Recommend terms even if they do not exist on the site',
5253
'classifai'
5354
),
5455
value: 'recommended_terms',
55-
},
56-
{
57-
label: __(
58-
'Only recommend terms that already exist on the site',
59-
'classifai'
60-
),
61-
value: 'existing_terms',
62-
},
63-
];
56+
} );
57+
}
6458

65-
if (
66-
[ 'openai_embeddings', 'azure_openai_embeddings' ].includes(
67-
featureSettings.provider
68-
)
69-
) {
70-
delete classifaicationMethodOptions[ 0 ];
71-
if ( featureSettings.classification_method === 'recommended_terms' ) {
72-
setFeatureSettings( {
73-
classification_method: 'existing_terms',
74-
} );
59+
classifaicationMethodOptions.push( {
60+
label: __(
61+
'Only recommend terms that already exist on the site',
62+
'classifai'
63+
),
64+
value: 'existing_terms',
65+
} );
66+
67+
useEffect( () => {
68+
if (
69+
[ 'openai_embeddings', 'azure_openai_embeddings' ].includes(
70+
featureSettings.provider
71+
)
72+
) {
73+
if (
74+
featureSettings.classification_method === 'recommended_terms'
75+
) {
76+
setFeatureSettings( {
77+
classification_method: 'existing_terms',
78+
} );
79+
}
7580
}
76-
}
81+
}, [
82+
featureSettings.provider,
83+
featureSettings.classification_method,
84+
setFeatureSettings,
85+
] );
7786

7887
return (
7988
<SettingsRow label={ __( 'Classification method', 'classifai' ) }>
@@ -201,6 +210,7 @@ export const ClassificationSettings = () => {
201210
'Used to preview the results for a particular post.',
202211
'classifai'
203212
) }
213+
__nextHasNoMarginBottom
204214
>
205215
<PostSelector showLabel={ false } />
206216
</BaseControl>
@@ -259,6 +269,7 @@ export const ClassificationSettings = () => {
259269
},
260270
} );
261271
} }
272+
__nextHasNoMarginBottom
262273
/>
263274
);
264275
} ) }
@@ -288,6 +299,7 @@ export const ClassificationSettings = () => {
288299
},
289300
} );
290301
} }
302+
__nextHasNoMarginBottom
291303
/>
292304
);
293305
} ) }

src/js/settings/components/feature-additional-settings/descriptive-text-generator.js

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const DescriptiveTextGeneratorSettings = () => {
5858
},
5959
} );
6060
} }
61+
__nextHasNoMarginBottom
6162
/>
6263
);
6364
} ) }

src/js/settings/components/feature-additional-settings/excerpt-generation.js

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const ExcerptGenerationSettings = () => {
7373
},
7474
} );
7575
} }
76+
__nextHasNoMarginBottom
7677
/>
7778
);
7879
} ) }

src/js/settings/components/feature-additional-settings/image-tag-generator.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const ImageTagGeneratorSettings = () => {
4646
} }
4747
value={ featureSettings.tag_taxonomy || 'classifai-image-tags' }
4848
options={ options }
49+
__nextHasNoMarginBottom
4950
/>
5051
</SettingsRow>
5152
);

src/js/settings/components/feature-additional-settings/moderation.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const ModerationSettings = () => {
5555
},
5656
} );
5757
} }
58+
__nextHasNoMarginBottom
5859
/>
5960
);
6061
} ) }

src/js/settings/components/feature-additional-settings/nlu-feature.js

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export const NLUFeatureSettings = () => {
111111
[ feature ]: value ? 1 : 0,
112112
} );
113113
} }
114+
__nextHasNoMarginBottom
114115
/>
115116
<InputControl
116117
id={ `${ feature }-threshold` }
@@ -150,6 +151,7 @@ export const NLUFeatureSettings = () => {
150151
[ `${ feature }_taxonomy` ]: value,
151152
} );
152153
} }
154+
__nextHasNoMarginBottom
153155
/>
154156
) }
155157
</SettingsRow>

src/js/settings/components/feature-additional-settings/prompt-repeater.js

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export const PromptRepeater = ( props ) => {
121121
} );
122122
} }
123123
className="classifai-prompt-text"
124+
__nextHasNoMarginBottom
124125
/>
125126
</>
126127
) }

src/js/settings/components/feature-additional-settings/smart-404.js

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const Smart404Settings = () => {
102102
rescore: value ? '1' : '0',
103103
} );
104104
} }
105+
__nextHasNoMarginBottom
105106
/>
106107
</SettingsRow>
107108
<SettingsRow
@@ -119,6 +120,7 @@ export const Smart404Settings = () => {
119120
fallback: value ? '1' : '0',
120121
} );
121122
} }
123+
__nextHasNoMarginBottom
122124
/>
123125
</SettingsRow>
124126
<SettingsRow
@@ -151,6 +153,7 @@ export const Smart404Settings = () => {
151153
value: 'l2_norm',
152154
},
153155
] }
156+
__nextHasNoMarginBottom
154157
/>
155158
</SettingsRow>
156159
</>

src/js/settings/components/feature-additional-settings/term-cleanup.js

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const TermCleanupSettings = () => {
9292
use_ep: value ? '1' : '0',
9393
} );
9494
} }
95+
__nextHasNoMarginBottom
9596
/>
9697
</SettingsRow>
9798
<>
@@ -118,6 +119,7 @@ export const TermCleanupSettings = () => {
118119
},
119120
} );
120121
} }
122+
__nextHasNoMarginBottom
121123
/>
122124
<InputControl
123125
id={ `${ feature }-threshold` }

src/js/settings/components/feature-additional-settings/text-to-speech.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const TextToSpeechSettings = () => {
5050
},
5151
} );
5252
} }
53+
__nextHasNoMarginBottom
5354
/>
5455
);
5556
} ) }

src/js/settings/components/feature-settings/enable-feature.js

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const EnableToggleControl = ( { children } ) => {
4545
status: value ? '1' : '0', // TODO: Use boolean, currently using string for backward compatibility.
4646
} )
4747
}
48+
__nextHasNoMarginBottom
4849
/>
4950
</SettingsRow>
5051
);

src/js/settings/components/provider-settings/amazon-polly.js

+2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export const AmazonPollySettings = ( { isConfigured = false } ) => {
140140
value: 'long-form',
141141
},
142142
] }
143+
__nextHasNoMarginBottom
143144
/>
144145
</SettingsRow>
145146
<SettingsRow label={ __( 'Voice', 'classifai' ) }>
@@ -159,6 +160,7 @@ export const AmazonPollySettings = ( { isConfigured = false } ) => {
159160
label: `${ voice?.LanguageName } - ${ voice?.Name } (${ voice?.Gender })`,
160161
};
161162
} ) }
163+
__nextHasNoMarginBottom
162164
/>
163165
</SettingsRow>
164166
</>

src/js/settings/components/provider-settings/azure-text-to-speech.js

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const AzureTextToSpeechSettings = ( { isConfigured = false } ) => {
9393
value: `${ ele.ShortName }|${ ele.Gender }`,
9494
} )
9595
) }
96+
__nextHasNoMarginBottom
9697
/>
9798
</SettingsRow>
9899
) }

src/js/settings/components/provider-settings/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export const ProviderSettings = () => {
168168
}
169169
value={ provider }
170170
options={ providers }
171+
__nextHasNoMarginBottom
171172
/>
172173
</SettingsRow>
173174
) }

src/js/settings/components/provider-settings/openai-dalle.js

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const OpenAIDallESettings = ( { isConfigured = false } ) => {
7878
label: i + 1,
7979
value: i + 1,
8080
} ) ) }
81+
__nextHasNoMarginBottom
8182
/>
8283
</SettingsRow>
8384
<SettingsRow
@@ -101,6 +102,7 @@ export const OpenAIDallESettings = ( { isConfigured = false } ) => {
101102
value: 'hd',
102103
},
103104
] }
105+
__nextHasNoMarginBottom
104106
/>
105107
</SettingsRow>
106108
<SettingsRow
@@ -128,6 +130,7 @@ export const OpenAIDallESettings = ( { isConfigured = false } ) => {
128130
value: '1024x1792',
129131
},
130132
] }
133+
__nextHasNoMarginBottom
131134
/>
132135
</SettingsRow>
133136
<SettingsRow
@@ -151,6 +154,7 @@ export const OpenAIDallESettings = ( { isConfigured = false } ) => {
151154
value: 'natural',
152155
},
153156
] }
157+
__nextHasNoMarginBottom
154158
/>
155159
</SettingsRow>
156160
</>

src/js/settings/components/provider-settings/openai-text-to-speech.js

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const OpenAITextToSpeachSettings = ( { isConfigured = false } ) => {
101101
value: 'tts-1-hd',
102102
},
103103
] }
104+
__nextHasNoMarginBottom
104105
/>
105106
</SettingsRow>
106107
<SettingsRow
@@ -149,6 +150,7 @@ export const OpenAITextToSpeachSettings = ( { isConfigured = false } ) => {
149150
value: 'shimmer',
150151
},
151152
] }
153+
__nextHasNoMarginBottom
152154
/>
153155
</SettingsRow>
154156
<SettingsRow
@@ -172,6 +174,7 @@ export const OpenAITextToSpeachSettings = ( { isConfigured = false } ) => {
172174
value: 'wav',
173175
},
174176
] }
177+
__nextHasNoMarginBottom
175178
/>
176179
</SettingsRow>
177180
<SettingsRow

src/js/settings/components/service-settings/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const ServiceSettings = () => {
9898
};
9999

100100
const statuses = Object.keys( settings )
101-
.map( ( key ) => settings[ key ].status )
101+
.map( ( key ) => settings[ key ]?.status )
102102
.join( '' );
103103

104104
useEffect( () => {
@@ -138,6 +138,7 @@ export const ServiceSettings = () => {
138138
feature
139139
)
140140
}
141+
__nextHasNoMarginBottom
141142
/>
142143
</Flex>
143144
</FlexItem>

src/js/settings/components/user-permissions/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const UserPermissions = () => {
7777
} );
7878
} }
7979
className="classifai-settings__user-based-opt-out"
80+
__nextHasNoMarginBottom
8081
/>
8182
</SettingsRow>
8283
</PanelBody>

src/scss/settings.scss

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@
117117
display: none;
118118
}
119119

120+
.components-base-control.components-checkbox-control {
121+
margin-bottom: 8px;
122+
}
123+
120124
}
121125

122126
.save-settings-button{

0 commit comments

Comments
 (0)