Skip to content

Commit

Permalink
use error state and eslint cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed May 28, 2024
1 parent ae5faad commit 69791f1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/app/pages/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import PerformanceFeatureSettings from '../settings/performanceFeatureSettings';
import { Container, Page } from '@newfold/ui-component-library';

const Admin = () => {

return (
<Page title="Admin" className={ 'wppbh-app-settings-page' }>
<Container className={ 'wppbh-app-settings-container' }>
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/settings/helpCenterSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const HelpCenterSettings = () => {
setHelpCenter( ! helpCenter );
} else {
setHelpCenterLocked( true );
setError( true );
notifyError();
}
} );
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/settings/performanceFeatureSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const PerformanceFeatureSettings = () => {
setPerformance( ! performance );
} else {
setPerformanceLocked( true );
setError( true );
notifyError();
}
} );
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/settings/stagingFeatureSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const StagingFeatureSettings = () => {
setStaging( ! staging );
} else {
setStagingLocked( true );
setError( true );
notifyError();
}
} );
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/settings/wonderBlocksSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const WonderBlocksSettings = () => {
setWonderBlocks( ! wonderBlocks );
} else {
setWonderBlocksLocked( true );
setError( true );
notifyError();
}
} );
Expand Down
10 changes: 6 additions & 4 deletions src/app/util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export const featureToggle = async ( featureName, thenCallback ) => {
};

/**
* Helper to update UI elements with a class
* @param {boolean} enabled whether the element should be activated or deactivated
* @param {string} selector the css selector to find the element
* @param {string} className the css class to add/remove
* Helper to update UI elements as features are enabled/disabled
*
* @param {string} selector css selector to find the element
* @param {boolean} enabled whether the element is now activated/deactivated
* @param {string} className the css class to add/remove - default 'nfd-disabled'
* @param {boolean} forceReload whether this update requires a forced page reload - default false
*/
export const updateUI = (
selector,
Expand Down

0 comments on commit 69791f1

Please sign in to comment.