Skip to content

Commit

Permalink
add features store and other cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Jun 6, 2024
1 parent 64a5630 commit 3d4bccb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/app/data/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ export const AppStoreProvider = ( { children } ) => {
if ( false === booted ) {
hgApiFetchSettings()
.then( ( settings ) => {
setStore( { ...store, ...window.HGWP, ...settings } );
setStore( {
...store,
...window.HGWP,
...settings,
features: window.NewfoldFeatures.features,
toggleableFeatures: window.NewfoldFeatures.togglable,
} );
setBooted( true );
} )
.catch( ( error ) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const AppBody = ( props ) => {
id="hgwp-app-rendered"
className={ classnames(
'wpadmin-brand-hostgator',
`wppbh-wp-${ NewfoldRuntime.sdk.wpversion }`,
`hgwp-wp-${ NewfoldRuntime.sdk.wpversion }`,
`hgwp-page-${ kebabCase( location.pathname ) }`,
props.className,
'nfd-w-full nfd-p-4 min-[783px]:nfd-p-0'
Expand Down
8 changes: 4 additions & 4 deletions src/app/pages/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ 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' }>
<Page title="Admin" className={ 'hgwp-app-settings-page' }>
<Container className={ 'hgwp-app-settings-container' }>
<Container.Header
title={ __( 'Admin', 'wp-plugin-hostgator' ) }
description={ __(
'Secret page to manage admin features and settings.',
'wp-plugin-hostgator'
) }
className={ 'wppbh-app-settings-header' }
className={ 'hgwp-app-settings-header' }
/>

<Container.Block
separator={ true }
id={ 'help-center' }
className={ classNames( 'wppbh-app-admin' ) }
className={ classNames( 'hgwp-app-admin' ) }
>
<Container.SettingsField
title="Features"
Expand Down
16 changes: 15 additions & 1 deletion src/app/pages/settings/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Container, Page } from '@newfold/ui-component-library';
import AutomaticUpdates from './automaticUpdates';
import ComingSoon from './comingSoon';
import AutomaticUpdates from './automaticUpdates';
import HelpCenterSettings from './helpCenterSettings';
import WonderBlocksSettings from './wonderBlocksSettings';
import CommentSettings from './commentSettings';
import ContentSettings from './contentSettings';

Expand All @@ -24,6 +26,18 @@ const Settings = () => {
<ComingSoon />
</Container.Block>

<Container.Block
separator={ true }
className={ 'hgwp-app-settings-wonder-blocks' }
>
<Container.SettingsField
title={ __( 'Features', 'wp-plugin-hostgator' ) }
></Container.SettingsField>
<WonderBlocksSettings />
<br />
<HelpCenterSettings />
</Container.Block>

<Container.Block
separator={ true }
className={ 'hgwp-app-settings-update' }
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/settings/performanceFeatureSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const PerformanceFeatureSettings = () => {
performance,
} );
notifySuccess( getPerformanceNoticeTitle, getPerformanceNoticeText );
updateUI( '.wppbh-app-navitem-Performance', performance );
updateUI( '.hgwp-app-navitem-Performance', performance );
}, [ performance ] );

return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/settings/stagingFeatureSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const StagingFeatureSettings = () => {
staging,
} );
notifySuccess( getStagingNoticeTitle, getStagingNoticeText );
updateUI( '.wppbh-app-navitem-Staging', staging );
updateUI( '.hgwp-app-navitem-Staging', staging );
}, [ staging ] );

return (
Expand Down

0 comments on commit 3d4bccb

Please sign in to comment.