Skip to content

Commit

Permalink
only show help center toggle on settings if not locked
Browse files Browse the repository at this point in the history
but always display on admin page
  • Loading branch information
circlecube committed May 28, 2024
1 parent 69791f1 commit 0dcc62a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 0 additions & 2 deletions inc/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

namespace Bluehost;

use function NewfoldLabs\WP\Module\Features\getFeatures;

/**
* \Bluehost\Data
* This class does not have a constructor to get instantiated, just static methods.
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Admin = () => {
>
<WonderBlocksSettings />
<br />
<HelpCenterSettings />
<HelpCenterSettings forceShow={ true } />
<br />
<StagingFeatureSettings />
<br />
Expand Down
26 changes: 14 additions & 12 deletions src/app/pages/settings/helpCenterSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AppStore from '../../data/store';
import { featureToggle, updateUI } from '../../util/helpers';
import { useNotification } from 'App/components/notifications';

const HelpCenterSettings = () => {
const HelpCenterSettings = ( { forceShow = false } ) => {
const { store, setStore } = useContext( AppStore );
const [ helpCenter, setHelpCenter ] = useState( store.features.helpCenter );
const [ helpCenterLocked, setHelpCenterLocked ] = useState(
Expand Down Expand Up @@ -75,17 +75,19 @@ const HelpCenterSettings = () => {

return (
<div className="nfd-flex nfd-flex-col nfd-gap-6">
<ToggleField
id="help-center-toggle"
label="Help Center"
description={ __(
'The Help Center provides guided, step-by-step assistance as you build your site.',
'wp-plugin-bluehost'
) }
disabled={ helpCenterLocked }
checked={ helpCenter }
onChange={ toggleHelpCenter }
/>
{ ( ! helpCenterLocked || forceShow ) && (
<ToggleField
id="help-center-toggle"
label="Help Center"
description={ __(
'The Help Center provides guided, step-by-step assistance as you build your site.',
'wp-plugin-bluehost'
) }
disabled={ helpCenterLocked }
checked={ helpCenter }
onChange={ toggleHelpCenter }
/>
) }

{ isError && (
<Alert variant="error">
Expand Down

0 comments on commit 0dcc62a

Please sign in to comment.