Skip to content

Commit

Permalink
fix: make onboarding title/logo setting work nicely with Neve
Browse files Browse the repository at this point in the history
  • Loading branch information
HardeepAsrani committed Aug 17, 2024
1 parent 4982099 commit 9c32474
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/onboarding/components/Finish.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ const Finish = () => {
const [ email, setEmail ] = useState( window.otterOnboardingData?.userEmail );
const [ isLoading, setIsLoading ] = useState( false );

const { hasUserOptedin } = useSelect( select => {
const {
hasUserOptedin,
currentTheme
} = useSelect( select => {
const { get } = select( 'core/preferences' );
const { getCurrentTheme } = select( 'core' );

return {
hasUserOptedin: get( 'themeisle/otter-blocks', 'onboarding-optin' )
hasUserOptedin: get( 'themeisle/otter-blocks', 'onboarding-optin' ),
currentTheme: getCurrentTheme()?.template || getCurrentTheme()?.stylesheet
};
}, []);

Expand Down Expand Up @@ -58,7 +63,7 @@ const Finish = () => {
'Cache-Control': 'no-cache'
},
body: JSON.stringify({
slug: 'raft', // We need to see how we can make it work for any themes
slug: currentTheme,
site: window.otterOnboardingData.rootUrl,
email
})
Expand Down
7 changes: 5 additions & 2 deletions src/onboarding/components/steps/SiteInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ const SiteInfo = () => {

const blocks = select( 'core/block-editor' ).getBlocks();

let siteLogoBlock = findBlock( blocks, 'core/site-logo' );
const siteLogoBlock = findBlock( blocks, 'core/site-logo' );
const siteTitleBlock = findBlock( blocks, 'core/site-title' );

if ( siteLogoBlock ) {
// We only want to replace site logo with site title if site title is not present.
// In themes like Neve FSE, we have both site title and site logo.
if ( siteLogoBlock && ! siteTitleBlock ) {
replaceBlock( siteLogoBlock.clientId, wp.blocks.createBlock(
'core/site-title',
{
Expand Down

0 comments on commit 9c32474

Please sign in to comment.