diff --git a/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js b/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js index b61800f6c..8055dba22 100644 --- a/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js +++ b/src/OnboardingSPA/components/TextInput/TextInputSiteGen/index.js @@ -1,4 +1,5 @@ import classNames from 'classnames'; +import { __ } from '@wordpress/i18n'; import { useRef, useEffect, useState, memo } from '@wordpress/element'; const TextInputSiteGen = ( { @@ -17,7 +18,7 @@ const TextInputSiteGen = ( { textareaRef.current.style.height = height; const scrollHeight = textareaRef.current.scrollHeight; textareaRef.current.style.height = scrollHeight + 'px'; - const analysisResult = calculateAnalysisScore( customerInput ); + const analysisResult = calculateAnalysisScore( customerInput?.trim() ); setAnalysisScore( analysisResult ); setIsValidInput( analysisResult >= 2 ); }, [ customerInput ] ); @@ -87,7 +88,7 @@ const TextInputSiteGen = ( { { customerInput ? (
- Detail + { __( 'Detail', 'wp-module-onboarding' ) }
{ renderDetails() }
diff --git a/src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js b/src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js index bf42a1182..7523ce3a0 100644 --- a/src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js +++ b/src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js @@ -40,15 +40,21 @@ const SiteGenSiteDetails = () => { setDrawerActiveView( false ); if ( currentData.sitegen.siteDetails?.prompt !== '' ) { + setIsValidInput( true ); + setFooterNavEnabled( true ); return setCustomerInput( currentData.sitegen.siteDetails.prompt ); } setFooterNavEnabled( false ); }, [] ); useEffect( () => { - setFooterNavEnabled( isValidInput ); - currentData.sitegen.siteDetails.prompt = customerInput?.trim(); - setCurrentOnboardingData( currentData ); + if ( customerInput?.trim() === '' ) { + setFooterNavEnabled( false ); + } else { + setFooterNavEnabled( isValidInput ); + currentData.sitegen.siteDetails.prompt = customerInput?.trim(); + setCurrentOnboardingData( currentData ); + } }, [ customerInput ] ); return (