Skip to content

Commit cd9d0ee

Browse files
committed
refactor: bento custom field component
1 parent c147b4c commit cd9d0ee

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

frontend-dev/src/components/AllIntegrations/Bento/BentoCommonFunc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ export const bentoAuthentication = (
8686
})
8787
}
8888

89-
export const getFields = (confTmp, setConf, action, setLoading) => {
90-
setLoading({ ...setLoading, fields: true })
89+
export const getFields = (confTmp, setConf, action, setIsLoading) => {
90+
setIsLoading(true)
9191

9292
bitsFetch(setRequestParams(confTmp, { action: action }), 'bento_get_fields').then((result) => {
93-
setLoading({ ...setLoading, fields: false })
93+
setIsLoading(false)
9494

9595
if (result?.success && result?.data) {
9696
setConf((prevConf) => create(prevConf, draftConf => {

frontend-dev/src/components/AllIntegrations/Bento/BentoFieldMap.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function BentoFieldMap({ i, formFields, field, bentoConf, setBent
7979
))
8080
)}
8181
{bentoConf.action === 'add_event' && (
82-
<option value="customFieldKey">{__('Custom Field', 'bit-integrations')}</option>
82+
<option value="customFieldKey">{__('Custom Field Key', 'bit-integrations')}</option>
8383
)}
8484
</select>
8585
{field.bentoFormField === 'customFieldKey' && (

frontend-dev/src/components/AllIntegrations/Bento/BentoIntegLayout.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function BentoIntegLayout({
2828

2929
const setChanges = (val, name) => {
3030
if (name === 'action' && val !== '') {
31-
getFields(bentoConf, setBentoConf, val, setLoading)
31+
getFields(bentoConf, setBentoConf, val, setIsLoading)
3232
}
3333

3434
setBentoConf(prevConf =>
@@ -59,7 +59,7 @@ export default function BentoIntegLayout({
5959
</div>
6060
<br />
6161
<br />
62-
{(isLoading || loading.fields || loading.session) && (
62+
{isLoading && (
6363
<Loader
6464
style={{
6565
display: 'flex',
@@ -77,7 +77,7 @@ export default function BentoIntegLayout({
7777
<div className="mt-5">
7878
<b className="wdt-100">{__('Field Map', 'bit-integrations')}</b>
7979
<button
80-
onClick={() => getFields(bentoConf, setBentoConf, bentoConf.action, setLoading)}
80+
onClick={() => getFields(bentoConf, setBentoConf, bentoConf.action, setIsLoading)}
8181
className="icn-btn sh-sm ml-2 mr-2 tooltip"
8282
style={{ '--tooltip-txt': `'${__('Refresh fields', 'bit-integrations')}'` }}
8383
type="button">

frontend-dev/src/components/AllIntegrations/Bento/EditBento.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function EditBento({ allIntegURL }) {
6767
setBentoConf={setBentoConf}
6868
loading={loading}
6969
setLoading={setLoading}
70+
isLoading={isLoading}
7071
setIsLoading={setIsLoading}
7172
setSnackbar={setSnackbar}
7273
/>

0 commit comments

Comments
 (0)