Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Jan 12, 2024
1 parent 75e89b9 commit 09914b3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/OnboardingSPA/steps/SiteGen/Preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ const SiteGenPreview = () => {
navigate( nextStep.path );
};

const scrollSelectionIntoView = () => {
if (
document.getElementsByClassName(
'nfd-onboarding-step--site-gen__preview__note'
)
) {
document
.getElementsByClassName(
'nfd-onboarding-step--site-gen__preview__note'
)[ 0 ]
.scrollIntoView( {
behavior: 'smooth',
block: 'end',
} );
}
};

const updateFavoriteStatus = ( slug, homepagesList ) => {
homepagesList.forEach( ( homepageObj ) => {
if ( homepageObj.slug === slug ) {
Expand Down Expand Up @@ -131,6 +148,7 @@ const SiteGenPreview = () => {
};

const handleRegenerate = async ( slug, colorPalattes, isFavourited ) => {
scrollSelectionIntoView();
setIsRegenerating( true );
if ( ! ( slug in homepages.data ) ) {
if ( currentData.sitegen.siteDetails?.prompt !== '' ) {
Expand Down

0 comments on commit 09914b3

Please sign in to comment.