From 4bd4c3ac1076a9f672d68dc21925a30721e3f325 Mon Sep 17 00:00:00 2001 From: manikantakailasa Date: Mon, 24 Jun 2024 18:39:42 +0530 Subject: [PATCH 1/7] fix: previews other than favorites in favorit tab --- .../Sidebar/components/SitegenEditorPatterns/Sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index 237b793b8..0debe78f2 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -128,7 +128,7 @@ const SitegenEditorPatternsSidebar = () => { }, [ currentData ] ); useEffect( () => { - setActiveTab( { + !( activeTab?.home === "favorites") && setActiveTab( { name: 'all_versions', title: (
From 5c8c72951331ab9f04d63d5b47f7bfc8916adfba Mon Sep 17 00:00:00 2001 From: manikantakailasa Date: Mon, 24 Jun 2024 18:43:48 +0530 Subject: [PATCH 2/7] lint fix --- .../Sidebar/components/SitegenEditorPatterns/Sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index 0debe78f2..37f698c2b 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -128,7 +128,7 @@ const SitegenEditorPatternsSidebar = () => { }, [ currentData ] ); useEffect( () => { - !( activeTab?.home === "favorites") && setActiveTab( { + ! ( activeTab?.home === 'favorites') && setActiveTab( { name: 'all_versions', title: (
From d64cc8b9f0b422b830de01d437ac3f7d78303efe Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Mon, 24 Jun 2024 18:58:49 +0530 Subject: [PATCH 3/7] linting fixes --- .../Sidebar/components/SitegenEditorPatterns/Sidebar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index 37f698c2b..2410f8082 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -128,7 +128,8 @@ const SitegenEditorPatternsSidebar = () => { }, [ currentData ] ); useEffect( () => { - ! ( activeTab?.home === 'favorites') && setActiveTab( { + if( ! ( activeTab?.home === 'favorites' ) ) { + setActiveTab( { name: 'all_versions', title: (
@@ -202,6 +203,7 @@ const SitegenEditorPatternsSidebar = () => { ); } ), } ); + } }, [ homepages, activeHomepage, globalStyles ] ); return ( From 89f789ac100afb69f248899fc3ea9ec99411faeb Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Mon, 24 Jun 2024 19:01:25 +0530 Subject: [PATCH 4/7] linting fixes --- .../SitegenEditorPatterns/Sidebar.js | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index 2410f8082..00d1f02b7 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -128,81 +128,81 @@ const SitegenEditorPatternsSidebar = () => { }, [ currentData ] ); useEffect( () => { - if( ! ( activeTab?.home === 'favorites' ) ) { - setActiveTab( { - name: 'all_versions', - title: ( -
-

{ __( 'All Versions', 'wp-module-onboarding' ) }

-
- ), - content: - homepages && - activeHomepage && - globalStyles && - Object.keys( homepages ).map( ( homepage, idx ) => { - const data = homepages[ homepage ]; - const newPreviewSettings = cloneDeep( globalStyles[ 0 ] ); - newPreviewSettings.settings.color.palette = - data.color.palette; - let blockGrammar = ''; - [ 'header', 'content', 'footer' ].forEach( ( part ) => { - if ( part in data ) { - blockGrammar += data[ part ]; - } - } ); - return ( -
+ if ( ! ( activeTab?.home === 'favorites' ) ) { + setActiveTab( { + name: 'all_versions', + title: ( +
+

{ __( 'All Versions', 'wp-module-onboarding' ) }

+
+ ), + content: + homepages && + activeHomepage && + globalStyles && + Object.keys( homepages ).map( ( homepage, idx ) => { + const data = homepages[ homepage ]; + const newPreviewSettings = cloneDeep( globalStyles[ 0 ] ); + newPreviewSettings.settings.color.palette = + data.color.palette; + let blockGrammar = ''; + [ 'header', 'content', 'footer' ].forEach( ( part ) => { + if ( part in data ) { + blockGrammar += data[ part ]; + } + } ); + return (
- handlePreview( data.slug, idx ) - } - role="button" - tabIndex={ 0 } - onKeyDown={ () => - handlePreview( data.slug, idx ) - } + className={ `nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container` } + key={ data.slug } > - -
- -
- handleFavorite( data.slug, idx ) + handlePreview( data.slug, idx ) } + role="button" + tabIndex={ 0 } onKeyDown={ () => - handleFavorite( data.slug, idx ) + handlePreview( data.slug, idx ) } - >
-

- { data.title } -

+ > + +
+ +
+
+ handleFavorite( data.slug, idx ) + } + onKeyDown={ () => + handleFavorite( data.slug, idx ) + } + >
+

+ { data.title } +

+
-
- ); - } ), - } ); + ); + } ), + } ); } }, [ homepages, activeHomepage, globalStyles ] ); From 199c5c686b64e1f3426e7471300eb7034c52929e Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Mon, 24 Jun 2024 19:04:02 +0530 Subject: [PATCH 5/7] linting fixes --- .../Sidebar/components/SitegenEditorPatterns/Sidebar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index 00d1f02b7..d52545f47 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -129,7 +129,7 @@ const SitegenEditorPatternsSidebar = () => { useEffect( () => { if ( ! ( activeTab?.home === 'favorites' ) ) { - setActiveTab( { + setActiveTab( { name: 'all_versions', title: (
@@ -202,8 +202,8 @@ const SitegenEditorPatternsSidebar = () => {
); } ), - } ); - } + } ); + } }, [ homepages, activeHomepage, globalStyles ] ); return ( From c2c1246d247d795908c57d5205a19cd06fd0f63c Mon Sep 17 00:00:00 2001 From: ManikantaKailasa <79800178+manikantakailasa@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:51:20 +0530 Subject: [PATCH 6/7] suggestions update Co-authored-by: Arun Shenoy --- .../Sidebar/components/SitegenEditorPatterns/Sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index d52545f47..504f7c254 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -128,7 +128,7 @@ const SitegenEditorPatternsSidebar = () => { }, [ currentData ] ); useEffect( () => { - if ( ! ( activeTab?.home === 'favorites' ) ) { + if ( activeTab?.home !== 'favorites' ) { setActiveTab( { name: 'all_versions', title: ( From 5b3349d6fe96a8685953b0357fd53f1628bd8892 Mon Sep 17 00:00:00 2001 From: manikantakailasa Date: Tue, 25 Jun 2024 12:10:03 +0530 Subject: [PATCH 7/7] update to name --- .../Sidebar/components/SitegenEditorPatterns/Sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js index 504f7c254..1a7238f86 100644 --- a/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js +++ b/src/OnboardingSPA/components/Sidebar/components/SitegenEditorPatterns/Sidebar.js @@ -128,7 +128,7 @@ const SitegenEditorPatternsSidebar = () => { }, [ currentData ] ); useEffect( () => { - if ( activeTab?.home !== 'favorites' ) { + if ( activeTab?.name !== 'favorites' ) { setActiveTab( { name: 'all_versions', title: (