Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Site Title and Tagline #475

Merged
merged 8 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions includes/WP_Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct() {
if ( 'sitegen' === Data::current_flow() ) {
\add_action( 'load-themes.php', array( __CLASS__, 'mark_sitegen_generated_themes' ) );
SiteGenService::pre_set_filter_wonder_blocks_transients();
SiteGenService::instantiate_sitegen_hooks();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useRef } from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';
import { useLocation } from 'react-router-dom';
import { useSelect, useDispatch } from '@wordpress/data';

Expand Down Expand Up @@ -40,6 +41,12 @@
};
}, [] );

// Update Title and Tagline on the site.
const { editEntityRecord } = useDispatch( coreStore );
const { getEditedEntityRecord } = useSelect( ( select ) => {
return select( coreStore );
}, [] );

useEffect( () => {
document.body.classList.add( `nfd-brand-${ newfoldBrand }` );
}, [ newfoldBrand ] );
Expand Down Expand Up @@ -100,8 +107,7 @@
identifier,
skipCache
);

if ( data.body !== null ) {
if ( data !== null ) {
currentData.sitegen.siteGenMetaStatus.currentStatus += 1;
if (
currentData.sitegen.siteGenMetaStatus.currentStatus ===
Expand All @@ -110,6 +116,13 @@
currentData.sitegen.skipCache = false;
}
setCurrentOnboardingData( currentData );

if ( identifier === 'site_config' ) {
editEntityRecord( 'root', 'site', undefined, {
title: data.site_title,
description: data.tagline,
} );
}
}
} catch ( err ) {
if ( retryCount < MAX_RETRIES_SITE_GEN ) {
Expand Down Expand Up @@ -179,13 +192,13 @@
initializePlugins( pluginInstallHash );
setInterval( cronTrigger, 45000 );
}
}, [ initialize ] );

Check warning on line 195 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'pluginInstallHash'. Either include it or remove the dependency array

useEffect( () => {
syncStoreToDB();
generateSiteGenData();
handlePreviousStepTracking();
}, [ location.pathname ] );

Check warning on line 201 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'generateSiteGenData', 'handlePreviousStepTracking', and 'syncStoreToDB'. Either include them or remove the dependency array

useEffect( () => {
if (
Expand All @@ -196,12 +209,13 @@
syncStoreToDB();
}
prevSiteGenErrorStatus.current = siteGenErrorStatus;
}, [ siteGenErrorStatus ] );

Check warning on line 212 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'generateSiteGenData' and 'syncStoreToDB'. Either include them or remove the dependency array

useEffect( () => {
initializeThemes();
initializeSettings();
getEditedEntityRecord( 'root', 'site' );
}, [] );

Check warning on line 218 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'getEditedEntityRecord'. Either include it or remove the dependency array

return (
<ThemeProvider>
Expand Down
Loading