From 7c43621bc9059d0093a3987315b397ab5f5f8536 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Wed, 31 Jan 2024 17:51:41 +0530 Subject: [PATCH 1/2] Fix sitegen theme marker script --- package.json | 2 +- src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 2e6efe816..ba8f45fb4 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "scripts": { "build": "wp-scripts build ./src/onboarding.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.css", "format": "wp-scripts format ./src", - "start": "wp-scripts start ./src/onboarding.js", + "start": "wp-scripts start ./src/onboarding.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.css", "lint:js": "wp-scripts lint-js ./src", "lint:js:fix": "wp-scripts lint-js ./src --fix", "test:e2e": "npx cypress run", diff --git a/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js b/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js index b22dda751..01dd4e9b0 100644 --- a/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js +++ b/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js @@ -1,13 +1,12 @@ window.onload = function () { const homepages = window.nfdOnboarding.homepages.data; const activeTheme = window.nfdOnboarding.active; - homepages.forEach( ( homepage ) => { - const ele = document.getElementById( `${ homepage.slug }-name` ); + Object.keys( homepages ).forEach( ( slug ) => { + const homepage = homepages[ slug ]; + const ele = document.getElementById( `${ slug }-name` ); if ( ele ) { ele.innerHTML = - ( activeTheme === homepage.slug - ? 'Active:' - : '' ) + + ( activeTheme === slug ? 'Active:' : '' ) + ` From 5ab64b7fe6fc247c4bcf54f11be1a7af7703ac79 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Wed, 31 Jan 2024 18:04:53 +0530 Subject: [PATCH 2/2] Fix lint --- src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js b/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js index 01dd4e9b0..2c17106e0 100644 --- a/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js +++ b/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js @@ -1,4 +1,4 @@ -window.onload = function () { +window.onload = function() { const homepages = window.nfdOnboarding.homepages.data; const activeTheme = window.nfdOnboarding.active; Object.keys( homepages ).forEach( ( slug ) => {