diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 000000000..bfe0dce4a
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,30 @@
+module.exports = {
+ extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ],
+ settings: {
+ 'import/resolver': {
+ alias: {
+ map: [
+ [ 'App', './src/app' ],
+ [ 'Assets', './aseets' ],
+ ],
+ extensions: [ '.js', '.jsx', '.json' ],
+ },
+ },
+ },
+ globals: {
+ __: true,
+ _camelCase: true,
+ _filter: true,
+ _n: true,
+ classNames: true,
+ useContext: true,
+ useEffect: true,
+ useState: true,
+ },
+ rules: {
+ 'import/no-unresolved': [
+ 'error',
+ { ignore: [ '^App/', '^Assets/' ] },
+ ],
+ },
+};
diff --git a/package-lock.json b/package-lock.json
index 1bd0a17a5..e6a7c8443 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,6 +19,7 @@
"@wordpress/i18n": "^4.45.0",
"@wordpress/icons": "^9.36.0",
"classnames": "^2.3.2",
+ "eslint-import-resolver-alias": "^1.1.2",
"jquery": "^3.7.1",
"lodash": "^4.17.21",
"react": "^18.2.0",
@@ -32,9 +33,11 @@
"@tailwindcss/forms": "^0.5.6",
"@testing-library/cypress": "^10.0.1",
"@wordpress/env": "^8.11.0",
+ "@wordpress/eslint-plugin": "^17.3.0",
"@wordpress/scripts": "^26.16.0",
"cypress": "^13.4.0",
"cypress-axe": "^1.5.0",
+ "eslint-plugin-import": "^2.29.0",
"tailwindcss": "^3.3.5"
},
"engines": {
@@ -5200,9 +5203,9 @@
}
},
"node_modules/@wordpress/babel-plugin-import-jsx-pragma": {
- "version": "4.28.0",
- "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-4.28.0.tgz",
- "integrity": "sha512-rLZgUIku7r0tI0Qxm8hLZq/0ecymtTSEL6MXesztqOMc155ZWpsTOBjOJgfiL3vaO3Hj1eZrgNKTkJbqhZNDvQ==",
+ "version": "4.29.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-4.29.0.tgz",
+ "integrity": "sha512-VPAn1iVZae1sQ6QaiMKbp3AzFPbhBl6YQeDr3AKpj24GTiUmsho6WgxijzyhBEBX5xPHVCahhQ8mjiZ5Ql6FwA==",
"dev": true,
"engines": {
"node": ">=14"
@@ -5212,9 +5215,9 @@
}
},
"node_modules/@wordpress/babel-preset-default": {
- "version": "7.29.0",
- "resolved": "https://registry.npmjs.org/@wordpress/babel-preset-default/-/babel-preset-default-7.29.0.tgz",
- "integrity": "sha512-MOhijDBuG+iKZaxp8k6nvq/C4XujyHCwkYEs1WZ5+vCzsdBXg3Axa7wqURyuMjJ+e7hzejyj0w6bm19woMcIiQ==",
+ "version": "7.30.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/babel-preset-default/-/babel-preset-default-7.30.0.tgz",
+ "integrity": "sha512-O/IA8Jvh6MzlTyeo0As2chhZ2w6WdvMYSjjTDDC66SkbnUxUf4jWqehncHGrtQLoQJfwsCUnyWSH4ePb/j+kIw==",
"dev": true,
"dependencies": {
"@babel/core": "^7.16.0",
@@ -5223,9 +5226,9 @@
"@babel/preset-env": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@babel/runtime": "^7.16.0",
- "@wordpress/babel-plugin-import-jsx-pragma": "^4.28.0",
- "@wordpress/browserslist-config": "^5.28.0",
- "@wordpress/warning": "^2.45.0",
+ "@wordpress/babel-plugin-import-jsx-pragma": "^4.29.0",
+ "@wordpress/browserslist-config": "^5.29.0",
+ "@wordpress/warning": "^2.46.0",
"browserslist": "^4.21.10",
"core-js": "^3.31.0",
"react": "^18.2.0"
@@ -5241,9 +5244,9 @@
"dev": true
},
"node_modules/@wordpress/browserslist-config": {
- "version": "5.28.0",
- "resolved": "https://registry.npmjs.org/@wordpress/browserslist-config/-/browserslist-config-5.28.0.tgz",
- "integrity": "sha512-6O4mgi4mZAizyPpcKjXoXwcF7onL+BJckH3M1JnnXoa0aBb42TB3wQMTYDcGc1Kg1sRD4HWaDl53inWdmiyk7g==",
+ "version": "5.29.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/browserslist-config/-/browserslist-config-5.29.0.tgz",
+ "integrity": "sha512-sVDgPWcI3wdKd3cIvgf/NLO7HtEkwyV4bWuSztzoemNMGQW17BhH2Blx46HnJFXm9ooYw4SpAOyioHTkuT+JFg==",
"dev": true,
"engines": {
"node": ">=14"
@@ -5784,16 +5787,16 @@
}
},
"node_modules/@wordpress/eslint-plugin": {
- "version": "17.2.0",
- "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-17.2.0.tgz",
- "integrity": "sha512-i2Gpu+hmGyqzprwyfFutHaJ1ZQRv8tYfkgC3ROdzc1yAKw4AHWSRSPWk79d6Ua87y3EIYVEffRV5cQf4nnEQAQ==",
+ "version": "17.3.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-17.3.0.tgz",
+ "integrity": "sha512-u6ZMf8sL4act3bNuX0CTuu9quCBw68BItpb5gpyo7LGmV4+/cic14GVWPBTroA9oz6z5UHjIfjKMqib7NGecWQ==",
"dev": true,
"dependencies": {
"@babel/eslint-parser": "^7.16.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
- "@wordpress/babel-preset-default": "^7.29.0",
- "@wordpress/prettier-config": "^3.2.0",
+ "@wordpress/babel-preset-default": "^7.30.0",
+ "@wordpress/prettier-config": "^3.3.0",
"cosmiconfig": "^7.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
@@ -6031,9 +6034,9 @@
}
},
"node_modules/@wordpress/prettier-config": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-3.2.0.tgz",
- "integrity": "sha512-/iNBuGgUm9ul/76PrUKHzg+KVdXvsAvThz9Ui4z0HQIEBzkvNxrZnofIdH0PJ7tEVPMomkvbWmV/IR0410yfog==",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-3.3.0.tgz",
+ "integrity": "sha512-G0HoubSikorLtXs0CZ0TNGbhKImCr+Ztg0HQUKv683r+yiZBOQV1igk7TaHOmIaf6702Bt4E3++IoAQN8Nr5ew==",
"dev": true,
"engines": {
"node": ">=14"
@@ -6393,9 +6396,9 @@
}
},
"node_modules/@wordpress/warning": {
- "version": "2.45.0",
- "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.45.0.tgz",
- "integrity": "sha512-cutow0USHkFWYQn4ah46gjoE9NAeq3q5fFCIXQoAK8MLuD7EVCcBmO7WvYVK0GeelHd1g7/Y7fM3GtqFFkLegg==",
+ "version": "2.46.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.46.0.tgz",
+ "integrity": "sha512-oyUNmDz64nF8vnS9LaobXMIx6K5w+XhAtvo3Cjv3kCVIuWFwpxoeMus3pUo1A7v2H9zcW+E87zwEuqsLPYjNfQ==",
"dev": true,
"engines": {
"node": ">=12"
@@ -10602,6 +10605,17 @@
"eslint": ">=7.0.0"
}
},
+ "node_modules/eslint-import-resolver-alias": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-alias/-/eslint-import-resolver-alias-1.1.2.tgz",
+ "integrity": "sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w==",
+ "engines": {
+ "node": ">= 4"
+ },
+ "peerDependencies": {
+ "eslint-plugin-import": ">=1.4.0"
+ }
+ },
"node_modules/eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
@@ -27130,15 +27144,15 @@
}
},
"@wordpress/babel-plugin-import-jsx-pragma": {
- "version": "4.28.0",
- "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-4.28.0.tgz",
- "integrity": "sha512-rLZgUIku7r0tI0Qxm8hLZq/0ecymtTSEL6MXesztqOMc155ZWpsTOBjOJgfiL3vaO3Hj1eZrgNKTkJbqhZNDvQ==",
+ "version": "4.29.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-4.29.0.tgz",
+ "integrity": "sha512-VPAn1iVZae1sQ6QaiMKbp3AzFPbhBl6YQeDr3AKpj24GTiUmsho6WgxijzyhBEBX5xPHVCahhQ8mjiZ5Ql6FwA==",
"dev": true
},
"@wordpress/babel-preset-default": {
- "version": "7.29.0",
- "resolved": "https://registry.npmjs.org/@wordpress/babel-preset-default/-/babel-preset-default-7.29.0.tgz",
- "integrity": "sha512-MOhijDBuG+iKZaxp8k6nvq/C4XujyHCwkYEs1WZ5+vCzsdBXg3Axa7wqURyuMjJ+e7hzejyj0w6bm19woMcIiQ==",
+ "version": "7.30.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/babel-preset-default/-/babel-preset-default-7.30.0.tgz",
+ "integrity": "sha512-O/IA8Jvh6MzlTyeo0As2chhZ2w6WdvMYSjjTDDC66SkbnUxUf4jWqehncHGrtQLoQJfwsCUnyWSH4ePb/j+kIw==",
"dev": true,
"requires": {
"@babel/core": "^7.16.0",
@@ -27147,9 +27161,9 @@
"@babel/preset-env": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@babel/runtime": "^7.16.0",
- "@wordpress/babel-plugin-import-jsx-pragma": "^4.28.0",
- "@wordpress/browserslist-config": "^5.28.0",
- "@wordpress/warning": "^2.45.0",
+ "@wordpress/babel-plugin-import-jsx-pragma": "^4.29.0",
+ "@wordpress/browserslist-config": "^5.29.0",
+ "@wordpress/warning": "^2.46.0",
"browserslist": "^4.21.10",
"core-js": "^3.31.0",
"react": "^18.2.0"
@@ -27162,9 +27176,9 @@
"dev": true
},
"@wordpress/browserslist-config": {
- "version": "5.28.0",
- "resolved": "https://registry.npmjs.org/@wordpress/browserslist-config/-/browserslist-config-5.28.0.tgz",
- "integrity": "sha512-6O4mgi4mZAizyPpcKjXoXwcF7onL+BJckH3M1JnnXoa0aBb42TB3wQMTYDcGc1Kg1sRD4HWaDl53inWdmiyk7g==",
+ "version": "5.29.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/browserslist-config/-/browserslist-config-5.29.0.tgz",
+ "integrity": "sha512-sVDgPWcI3wdKd3cIvgf/NLO7HtEkwyV4bWuSztzoemNMGQW17BhH2Blx46HnJFXm9ooYw4SpAOyioHTkuT+JFg==",
"dev": true
},
"@wordpress/components": {
@@ -27623,16 +27637,16 @@
}
},
"@wordpress/eslint-plugin": {
- "version": "17.2.0",
- "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-17.2.0.tgz",
- "integrity": "sha512-i2Gpu+hmGyqzprwyfFutHaJ1ZQRv8tYfkgC3ROdzc1yAKw4AHWSRSPWk79d6Ua87y3EIYVEffRV5cQf4nnEQAQ==",
+ "version": "17.3.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-17.3.0.tgz",
+ "integrity": "sha512-u6ZMf8sL4act3bNuX0CTuu9quCBw68BItpb5gpyo7LGmV4+/cic14GVWPBTroA9oz6z5UHjIfjKMqib7NGecWQ==",
"dev": true,
"requires": {
"@babel/eslint-parser": "^7.16.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
- "@wordpress/babel-preset-default": "^7.29.0",
- "@wordpress/prettier-config": "^3.2.0",
+ "@wordpress/babel-preset-default": "^7.30.0",
+ "@wordpress/prettier-config": "^3.3.0",
"cosmiconfig": "^7.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
@@ -27800,9 +27814,9 @@
}
},
"@wordpress/prettier-config": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-3.2.0.tgz",
- "integrity": "sha512-/iNBuGgUm9ul/76PrUKHzg+KVdXvsAvThz9Ui4z0HQIEBzkvNxrZnofIdH0PJ7tEVPMomkvbWmV/IR0410yfog==",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-3.3.0.tgz",
+ "integrity": "sha512-G0HoubSikorLtXs0CZ0TNGbhKImCr+Ztg0HQUKv683r+yiZBOQV1igk7TaHOmIaf6702Bt4E3++IoAQN8Nr5ew==",
"dev": true
},
"@wordpress/primitives": {
@@ -28112,9 +28126,9 @@
}
},
"@wordpress/warning": {
- "version": "2.45.0",
- "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.45.0.tgz",
- "integrity": "sha512-cutow0USHkFWYQn4ah46gjoE9NAeq3q5fFCIXQoAK8MLuD7EVCcBmO7WvYVK0GeelHd1g7/Y7fM3GtqFFkLegg==",
+ "version": "2.46.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.46.0.tgz",
+ "integrity": "sha512-oyUNmDz64nF8vnS9LaobXMIx6K5w+XhAtvo3Cjv3kCVIuWFwpxoeMus3pUo1A7v2H9zcW+E87zwEuqsLPYjNfQ==",
"dev": true
},
"@xobotyi/scrollbar-width": {
@@ -31354,6 +31368,11 @@
"integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==",
"dev": true
},
+ "eslint-import-resolver-alias": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-alias/-/eslint-import-resolver-alias-1.1.2.tgz",
+ "integrity": "sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w=="
+ },
"eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
diff --git a/package.json b/package.json
index e4e54baf0..8afe157e1 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"@wordpress/i18n": "^4.45.0",
"@wordpress/icons": "^9.36.0",
"classnames": "^2.3.2",
+ "eslint-import-resolver-alias": "^1.1.2",
"jquery": "^3.7.1",
"lodash": "^4.17.21",
"react": "^18.2.0",
@@ -47,9 +48,11 @@
"@tailwindcss/forms": "^0.5.6",
"@testing-library/cypress": "^10.0.1",
"@wordpress/env": "^8.11.0",
+ "@wordpress/eslint-plugin": "^17.3.0",
"@wordpress/scripts": "^26.16.0",
"cypress": "^13.4.0",
"cypress-axe": "^1.5.0",
+ "eslint-plugin-import": "^2.29.0",
"tailwindcss": "^3.3.5"
},
"scripts": {
diff --git a/postcss.config.js b/postcss.config.js
index 4d8ae98c3..90a2477ed 100644
--- a/postcss.config.js
+++ b/postcss.config.js
@@ -1,8 +1,8 @@
module.exports = {
- plugins: [
- require("postcss-import"),
- require("tailwindcss/nesting"),
- require("tailwindcss"),
- ...require("@wordpress/postcss-plugins-preset"),
- ],
- };
\ No newline at end of file
+ plugins: [
+ require( 'postcss-import' ),
+ require( 'tailwindcss/nesting' ),
+ require( 'tailwindcss' ),
+ ...require( '@wordpress/postcss-plugins-preset' ),
+ ],
+};
diff --git a/set-latest-wp-version.js b/set-latest-wp-version.js
index 05d4074a3..0502410df 100644
--- a/set-latest-wp-version.js
+++ b/set-latest-wp-version.js
@@ -1,24 +1,26 @@
-const fs = require('fs')
-const fetch = require('node-fetch')
-const wpEnv = require('./.wp-env.json')
+const fs = require( 'fs' );
+const fetch = require( 'node-fetch' );
+const wpEnv = require( './.wp-env.json' );
-fetch('https://api.wordpress.org/core/stable-check/1.0/')
- .then(res => res.json())
- .then(
- json => {
- const wpVersion = Object.keys(json)[Object.keys(json).length - 1]
- wpEnv.core = `WordPress/WordPress#tags/${ wpVersion }`
- fs.writeFile(
- './.wp-env.json',
- JSON.stringify(wpEnv, null, 2),
- 'utf8',
- (err) => {
- if (err) {
- console.log('An error occurred while writing latest WordPress version to .wp-env.json file.')
- return console.log(err)
- }
- console.log(`The .wp-env.json file was updated with the latest WordPress version (${wpVersion}).`)
+fetch( 'https://api.wordpress.org/core/stable-check/1.0/' )
+ .then( ( res ) => res.json() )
+ .then( ( json ) => {
+ const wpVersion = Object.keys( json )[ Object.keys( json ).length - 1 ];
+ wpEnv.core = `WordPress/WordPress#tags/${ wpVersion }`;
+ fs.writeFile(
+ './.wp-env.json',
+ JSON.stringify( wpEnv, null, 2 ),
+ 'utf8',
+ ( err ) => {
+ if ( err ) {
+ console.log(
+ 'An error occurred while writing latest WordPress version to .wp-env.json file.'
+ );
+ return console.log( err );
}
- );
- }
- )
\ No newline at end of file
+ console.log(
+ `The .wp-env.json file was updated with the latest WordPress version (${ wpVersion }).`
+ );
+ }
+ );
+ } );
diff --git a/src/app/components/accordion/index.js b/src/app/components/accordion/index.js
deleted file mode 100644
index 851732604..000000000
--- a/src/app/components/accordion/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import './stylesheet.scss';
-
-const Accordion = ( { summary, className, children } ) => {
- return (
-
-
- { summary }
-
- { children }
-
- );
-};
-
-export default Accordion;
diff --git a/src/app/components/accordion/stylesheet.scss b/src/app/components/accordion/stylesheet.scss
deleted file mode 100644
index 21269fda6..000000000
--- a/src/app/components/accordion/stylesheet.scss
+++ /dev/null
@@ -1,33 +0,0 @@
-.wppbh .accordion {
- border: 1px solid var(--color-border);
- margin-bottom: .6em;
- margin-top: .6em;
- opacity: .8;
- padding: 1px;
- transition: opacity .2s ease;
-
- &:hover,
- &[open] {
- opacity: 1;
- }
-
- .accordion-summary {
- background: var(--color-off-white);
- cursor: pointer;
- font-weight: 700;
- padding: 10px 15px;
-
- p {
- display: inline;
- }
- }
-
- .accordion-content {
- padding: 0 15px;
- margin: 10px 0;
- }
-
- + .accordion {
- margin-top: -.6em;
- }
-}
diff --git a/src/app/components/app-nav/index.js b/src/app/components/app-nav/index.js
index 636c4a176..fd0af78d0 100644
--- a/src/app/components/app-nav/index.js
+++ b/src/app/components/app-nav/index.js
@@ -1,199 +1,205 @@
-import { Modal, SidebarNavigation } from "@newfold/ui-component-library"
-import { NavLink, useLocation } from 'react-router-dom';
+import { useEffect, useState } from '@wordpress/element';
import { useViewportMatch } from '@wordpress/compose';
-import Logo from "./logo";
-import { topRoutes, utilityRoutes } from "../../data/routes";
-import { Bars3Icon } from "@heroicons/react/24/outline";
-import { useEffect } from 'react';
-import { handleHelpLinksClick } from "../../util/helpers";
+import { Modal, SidebarNavigation } from '@newfold/ui-component-library';
+import { NavLink, useLocation } from 'react-router-dom';
+import { Bars3Icon } from '@heroicons/react/24/outline';
+import { topRoutes, utilityRoutes } from 'App/data/routes';
+import { handleHelpLinksClick } from '../../util/helpers';
+import Logo from './logo';
export const SideNavHeader = () => {
- return (
-
- );
-}
+ return (
+
+ );
+};
export const SideNavMenu = () => {
- let location = useLocation();
-
- const primaryMenu = () => {
- return (
-
- {topRoutes.map((page) => (
-
-
-
- ))}
-
- );
- }
-
- const secondaryMenu = () => {
- return (
-
- {utilityRoutes.map((page) => (
-
-
-
- ))}
-
- );
- }
-
- const SubMenusManager = () => {
- // close any open submenus
- const subMenus = document.querySelectorAll('.wppbh-app-navitem-submenu');
- subMenus.forEach((subMenu) => {
- subMenu.classList.add('nfd-hidden');
- });
-
- // open active's submenu if it exists
- const activeMenu = document.querySelector('.wppbh-app-sidenav .active');
- if (activeMenu && null !== activeMenu.nextSibling && activeMenu.nextSibling.classList.contains('wppbh-app-navitem-submenu')) {
- activeMenu.nextSibling.classList.remove('nfd-hidden');
- }
- }
-
- useEffect(() => {
- SubMenusManager();
- document.onclick = SubMenusManager;
- }, [location]);
-
- return (
-
- {primaryMenu()}
- {secondaryMenu()}
-
- );
-}
-
-export const SideNavMenuItem = ({ label, name, icon: Icon = null, path, action, subItems }) => {
- return (
-
-
- {Icon &&
-
- }
- {label}
-
-
- {subItems && subItems.length > 0 &&
-
- {subItems.map((subItem) => (
-
- ))}
-
- }
-
- );
-}
-
-export const SideNavMenuSubItem = ({ label, name, path, action }) => {
- return (
-
-
- {label}
-
-
- );
-}
+ const location = useLocation();
+
+ const primaryMenu = () => {
+ return (
+
+ { topRoutes.map( ( page ) => (
+
+ ) ) }
+
+ );
+ };
+
+ const secondaryMenu = () => {
+ return (
+
+ { utilityRoutes.map( ( page ) => (
+
+ ) ) }
+
+ );
+ };
+
+ const SubMenusManager = () => {
+ // close any open submenus
+ const subMenus = document.querySelectorAll(
+ '.wppbh-app-navitem-submenu'
+ );
+ subMenus.forEach( ( subMenu ) => {
+ subMenu.classList.add( 'nfd-hidden' );
+ } );
+
+ // open active's submenu if it exists
+ const activeMenu = document.querySelector(
+ '.wppbh-app-sidenav .active'
+ );
+ if (
+ activeMenu &&
+ null !== activeMenu.nextSibling &&
+ activeMenu.nextSibling.classList.contains(
+ 'wppbh-app-navitem-submenu'
+ )
+ ) {
+ activeMenu.nextSibling.classList.remove( 'nfd-hidden' );
+ }
+ };
+
+ useEffect( () => {
+ SubMenusManager();
+ document.onclick = SubMenusManager;
+ }, [ location ] );
+
+ return (
+
+ { primaryMenu() }
+ { secondaryMenu() }
+
+ );
+};
+
+export const SideNavMenuItem = ( {
+ label,
+ icon: Icon = null,
+ path,
+ action,
+ subItems,
+} ) => {
+ return (
+
+
+ { Icon && (
+
+ ) }
+ { label }
+
+
+ { subItems && subItems.length > 0 && (
+
+ { subItems.map( ( subItem ) => (
+
+ ) ) }
+
+ ) }
+
+ );
+};
+
+export const SideNavMenuSubItem = ( { label, path, action } ) => {
+ return (
+
+
+ { label }
+
+
+ );
+};
export const SideNav = () => {
- return (
-
- );
-}
+ return (
+
+ );
+};
export const MobileNav = () => {
- const [isOpen, setIsOpen] = useState(false);
-
- let location = useLocation();
- // Close mobile nav when location changes
- useEffect(() => {
- setIsOpen(false);
- }, [location]);
-
- return (
-
-
-
-
-
-
-
{ setIsOpen(true) }}
- >
- Open Navingation Menu
-
-
-
-
setIsOpen(false)}
- className="wppbh-app-sidenav-mobile nfd-z-40"
- initialFocus
- >
-
-
-
-
-
-
-
-
-
- );
-}
+ const [ isOpen, setIsOpen ] = useState( false );
+
+ const location = useLocation();
+ // Close mobile nav when location changes
+ useEffect( () => {
+ setIsOpen( false );
+ }, [ location ] );
+
+ return (
+
+
+
+
+
+
{
+ setIsOpen( true );
+ } }
+ >
+ Open Navingation Menu
+
+
+
+
setIsOpen( false ) }
+ className="wppbh-app-sidenav-mobile nfd-z-40"
+ initialFocus
+ >
+
+
+
+
+
+
+
+
+ );
+};
export const AppNav = () => {
- const isLargeViewport = useViewportMatch('medium');
- handleHelpLinksClick();
-
- return (
- <>
- {(isLargeViewport && ) || }
- >
+ const isLargeViewport = useViewportMatch( 'medium' );
+ handleHelpLinksClick();
- );
-}
\ No newline at end of file
+ return <>{ ( isLargeViewport && ) || }>;
+};
diff --git a/src/app/components/app-nav/logo.js b/src/app/components/app-nav/logo.js
index a29bc2ca2..ccc7e3895 100644
--- a/src/app/components/app-nav/logo.js
+++ b/src/app/components/app-nav/logo.js
@@ -1,6 +1,6 @@
import { Button } from '@wordpress/components';
-import { Heading } from '..';
-import { ReactComponent as Brand } from '../../../../assets/svg/bluehost-logo.svg';
+import { Title } from '@newfold/ui-component-library';
+import { ReactComponent as Brand } from 'Assets/svg/bluehost-logo.svg';
import { delay } from 'lodash';
const Mark = () => {
@@ -27,9 +27,9 @@ const Logo = () => {
return (
-
+
{ __( 'Bluehost WordPress Plugin', 'wp-plugin-bluehost' ) }
-
+
);
};
diff --git a/src/app/components/errorCard/index.js b/src/app/components/errorCard/index.js
index 0a2b437a4..abba3619e 100644
--- a/src/app/components/errorCard/index.js
+++ b/src/app/components/errorCard/index.js
@@ -1,3 +1,4 @@
+import { Title } from '@newfold/ui-component-library';
import './stylesheet.scss';
import {
Card,
@@ -6,7 +7,6 @@ import {
CardFooter,
Dashicon,
} from '@wordpress/components';
-import { Heading } from '../../components';
import { dispatchUpdateSnackbar } from '../../util/helpers';
const ErrorCard = ( { error, className, notice = 'Error!' } ) => {
@@ -15,7 +15,7 @@ const ErrorCard = ( { error, className, notice = 'Error!' } ) => {
return (
-
+
{
} }
/>{ ' ' }
{ __( 'Oh No, An Error!', 'wp-plugin-bluehost' ) }
-
+
diff --git a/src/app/components/header/index.js b/src/app/components/header/index.js
deleted file mode 100644
index 5b0a697cc..000000000
--- a/src/app/components/header/index.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import './stylesheet.scss';
-
-import Logo from './logo';
-import NavLarge from './nav-large';
-import NavMobile from './nav-mobile';
-import NavUtility from './nav-utility';
-import { useViewportMatch } from '@wordpress/compose';
-
-const Header = () => {
- const isLargeViewport = useViewportMatch( 'medium' );
- return (
-
-
- { isLargeViewport && (
-
-
-
- ) }
-
- );
-};
-
-export default Header;
diff --git a/src/app/components/header/logo.js b/src/app/components/header/logo.js
deleted file mode 100644
index 8b6e8f846..000000000
--- a/src/app/components/header/logo.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Button } from '@wordpress/components';
-import { Heading } from '../../components';
-import { ReactComponent as Brand } from '../../../../assets/svg/bluehost-logo.svg';
-import { delay } from 'lodash';
-
-const Mark = () => {
- const defocus = () => {
- const button = document.querySelector( '.logo-mark' );
- delay( () => {
- if ( null !== button ) {
- button.blur();
- }
- }, 500 );
- };
- return (
- }
- style={ { height: '39px' } }
- iconSize={ 39 }
- onMouseUp={ defocus }
- className="logo-mark"
- href="#/home"
- />
- );
-};
-
-const Logo = () => {
- return (
-
-
-
- { __( 'Bluehost WordPress Plugin', 'wp-plugin-bluehost' ) }
-
-
- );
-};
-
-export default Logo;
diff --git a/src/app/components/header/nav-large.js b/src/app/components/header/nav-large.js
deleted file mode 100644
index c7ceab4a0..000000000
--- a/src/app/components/header/nav-large.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import classNames from 'classnames';
-import { NavLink } from 'react-router-dom';
-import { topRoutes } from '../../data/routes';
-
-const NavLarge = () => (
-
- { topRoutes.map( ( page ) => (
-
-
-
- { page.title }
-
-
-
- ) ) }
-
-);
-
-export default NavLarge;
diff --git a/src/app/components/header/nav-mobile.js b/src/app/components/header/nav-mobile.js
deleted file mode 100644
index 10305f3f4..000000000
--- a/src/app/components/header/nav-mobile.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import { Button, Modal } from '@wordpress/components';
-import { menu } from '@wordpress/icons';
-import { topRoutes } from '../../data/routes';
-import { NavLink } from 'react-router-dom';
-
-const NavMobile = () => {
- const [ isOpen, setIsOpen ] = useState( false );
- const MobileMenu = () => {
- return (
-
- { topRoutes.map( ( page ) => (
-
- setIsOpen( false ) }
- className={ `components-button is-secondary mobile-link-${ page.title }` }
- style={ { width: '100%', textAlign: 'center' } }
- >
- { page.title }
-
-
- ) ) }
-
- );
- };
- return (
-
- setIsOpen( ! isOpen ) }
- className="mobile-toggle"
- />
- { isOpen && (
- setIsOpen( false ) }>
-
-
- ) }
-
- );
-};
-
-export default NavMobile;
diff --git a/src/app/components/header/nav-utility.js b/src/app/components/header/nav-utility.js
deleted file mode 100644
index aa9edddac..000000000
--- a/src/app/components/header/nav-utility.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Icon } from '@wordpress/icons';
-import { Dashicon } from '@wordpress/components';
-import { NavLink } from 'react-router-dom';
-import { utilityRoutes } from '../../data/routes';
-
-const NavUtility = () => (
-
- { utilityRoutes.map( ( page ) => (
-
-
- { page.Icon && (
-
- ) }
- { page.Dashicon && (
-
- ) }
-
-
- ) ) }
-
-);
-
-export default NavUtility;
diff --git a/src/app/components/header/stylesheet.scss b/src/app/components/header/stylesheet.scss
deleted file mode 100644
index db2b9cd9e..000000000
--- a/src/app/components/header/stylesheet.scss
+++ /dev/null
@@ -1,150 +0,0 @@
-.wppbh-header {
- align-content: center;
- background: var(--color-white);
- display:flex;
- align-items: center;
- justify-content: space-between;
- padding: 12px 12px 12px 0;
- &-inner {
- display: flex;
- justify-content: space-between;
- align-items: center;
- max-width: 1320px;
- margin: 0 auto;
- width: 100%;
- }
-}
-
-// .wppbh-logo-wrap {
-// margin-left: 12px;
-// a.components-button {
-// padding: 2rem 12px;
-// border-radius: 0 !important;
-// &:focus:not(:disabled) {
-// box-shadow: inset 0px 0px 0px 1px var(--color-primary);
-// }
-// }
-// }
-
-.wppbh-nav-utility {
- align-content: center;
- display: flex;
-}
-.wppbh-nav-utility-link {
- display: block;
- margin: 6px 16px 0 0;
-}
-
-.wppbh-nav {
- padding: 1.33rem;
- will-change: background-color;
- transition: background-color 0.33s ease;
- background-color: var(--color-primary);
- background: linear-gradient(114deg, var(--color-primary) 45%, var(--color-primary) 60%, var(--color-primary) 80%);
-}
-
-.wppbh-nav-large {
- display: flex;
- list-style: none;
- max-width: 1320px;
- margin: 0 auto;
- gap: 2rem;
- li {
- margin-bottom: 0; // wp core override
- display: flex;
- position: relative;
- top: 3.5px;
- &:first-of-type {
- margin-left: 1rem;
- }
- }
- .wppbh-nav-large__link {
- display: inline;
- color: var(--color-white) !important;
- cursor: pointer;
- text-decoration: none;
- font-size: 1rem;
- letter-spacing: 1px;
- font-weight: 500;
- transition: all;
- box-shadow: none !important;
- -webkit-box-direction: normal;
- white-space: nowrap;
- &:after {
- content: '';
- background-color: var(--color-white);
- margin-top: 5px;
- height: 2px;
- width: 100%;
- display: block;
- position: relative;
- opacity: 0;
- -webkit-transition: opacity .3s,-webkit-transform .3s;
- transition: opacity .3s,transform .3s,-webkit-transform .3s;
- -webkit-transform: translate3d(-100%, 0, 0);
- transform: translate3d(-100%, 0, 0);
- box-sizing: border-box;
- }
- &.active:after,
- &:hover:after {
- -webkit-transform: translateZ(0);
- transform: translateZ(0);
- opacity: 1;
- }
- &.active:hover:after {
- opacity: 0.5;
- }
- }
-}
-
-
-.wppbh-page {
- // marketplace and default green applied in .wppbh-nav
-}
-
-.wppbh-nav-utility {
-
- a {
- text-decoration: none;
- fill: var(--color-text);
-
- span.dashicon {
- color: var(--color-text);
- width: 28px;
- height: 28px;
- font-size: 28px;
- }
-
- &.active {
- fill: var(--color-primary);
-
- span.dashicon {
- color: var(--color-primary);
- }
- }
- &:focus {
- box-shadow: none !important;
- }
- }
-}
-
-ul.nav-mobile {
- li {
- margin-bottom: 0.5rem;
- }
- a.components-button.is-secondary {
- padding: 1.5rem 1rem 1.66rem 1rem;
- color: var(--color-text);
- box-shadow: inset 0px 0px 0px 2px var(--color-text);
- &:hover,
- &:active {
- color: var(--color-primary-dark);
- box-shadow: inset 0px 0px 0px 2px var(--color-primary-dark);
- }
- }
-}
-
-.components-button.mobile-toggle.has-icon {
- padding-right: 6px;
- margin-right: 6px;
-}
\ No newline at end of file
diff --git a/src/app/components/heading/index.js b/src/app/components/heading/index.js
deleted file mode 100644
index 68249ed2c..000000000
--- a/src/app/components/heading/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const Heading = ( { level, className, children } ) => {
- const TagName = 'h' + level;
-
- return (
-
- { children }
-
- );
-};
-
-export default Heading;
diff --git a/src/app/components/icons/BluehostIcon.js b/src/app/components/icons/BluehostIcon.js
index c3e5cf4e5..9118592c2 100644
--- a/src/app/components/icons/BluehostIcon.js
+++ b/src/app/components/icons/BluehostIcon.js
@@ -1,9 +1,18 @@
-const BluehostIcon = () => {
- return (
-
-
-
- );
-}
+const BluehostIcon = ( {} ) => (
+
+
+
+);
-export default BluehostIcon;
\ No newline at end of file
+export default BluehostIcon;
diff --git a/src/app/components/icons/WordPressIcon.js b/src/app/components/icons/WordPressIcon.js
index d4f7229cb..9ba69a1f8 100644
--- a/src/app/components/icons/WordPressIcon.js
+++ b/src/app/components/icons/WordPressIcon.js
@@ -1,20 +1,46 @@
-const WordPressIcon = () => {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
+const WordPressIcon = ( {} ) => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
-export default WordPressIcon;
\ No newline at end of file
+export default WordPressIcon;
diff --git a/src/app/components/index.js b/src/app/components/index.js
index 4e1e92fd1..baf16ec6d 100644
--- a/src/app/components/index.js
+++ b/src/app/components/index.js
@@ -1,4 +1 @@
-export { default as Accordion } from './accordion';
export { default as ErrorCard } from './errorCard';
-export { default as Header } from './header';
-export { default as Heading } from './heading';
diff --git a/src/app/components/notifications/feed.js b/src/app/components/notifications/feed.js
deleted file mode 100644
index 967ef71ca..000000000
--- a/src/app/components/notifications/feed.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import { createContext, useContext, useReducer } from "@wordpress/element";
-import { Notifications } from "@newfold/ui-component-library";
-
-const actions = { PUSH: "push", DISMISS: "dismiss" };
-
-/**
- * @typedef FeedEntry
- * @property {string} title
- * @property {React.ReactNode | string[]} description
- * @property {"info" | "success" | "error" | "warning"} variant
- * @property {number} autoDismiss
- * @property {(id) => void | null} onDismiss
- * @property {"bottom-left" | "bottom-center" | "top-center"} position
- */
-
-/**
- *
- * @typedef FeedReducerAction
- * @property {"push" | "dismiss"} type
- * @property {string} id
- * @property {FeedEntry?} message
- *
- * @param {Record} feed
- * @param {FeedReducerAction} action
- * @returns {Record}
- */
-function feedReducer(feed, action) {
- switch (action.type) {
- case actions.PUSH:
- return { ...feed, [action.id]: action.message };
- case actions.DISMISS:
- return { ...feed, [action.id]: null };
- default:
- return feed;
- }
-}
-
-const FeedContext = createContext({
- push: (id, message) => {},
-});
-
-/** @type {() => { push: (id: string, message: FeedEntry) => void}} */
-export const useNotification = () => useContext(FeedContext);
-
-export function NotificationFeed({ children }) {
- let [feed, dispatch] = useReducer(feedReducer, {});
- return (
- <>
- dispatch({ type: actions.PUSH, id, message }),
- }}
- >
- {children}
-
-
- {Object.entries(feed)
- .filter(([, value]) => value !== null)
- .map(([key, { description, ...entry }]) => {
- let contentProps = Array.isArray(description)
- ? { description }
- : { children: description };
- return (
- {
- dispatch({ type: actions.DISMISS, id });
- if (entry.onDismiss) {
- entry.onDismiss(id);
- }
- }}
- />
- );
- })}
-
- >
- );
-}
diff --git a/src/app/components/notifications/index.js b/src/app/components/notifications/index.js
new file mode 100644
index 000000000..b212da37d
--- /dev/null
+++ b/src/app/components/notifications/index.js
@@ -0,0 +1,62 @@
+import { createContext, useContext, useReducer } from '@wordpress/element';
+import { Notifications } from '@newfold/ui-component-library';
+
+const ACTIONS = { PUSH: 'push', DISMISS: 'dismiss' };
+
+const feedReducer = ( feed, action ) => {
+ switch ( action.type ) {
+ case ACTIONS.PUSH:
+ return { ...feed, [ action.id ]: action.message };
+ case ACTIONS.DISMISS:
+ return { ...feed, [ action.id ]: null };
+ default:
+ return feed;
+ }
+};
+
+const FeedContext = createContext( {
+ // eslint-disable-next-line no-unused-vars
+ push: ( id, message ) => {},
+} );
+
+export const useNotification = () => useContext( FeedContext );
+
+export const NotificationFeed = ( { children } ) => {
+ const [ feed, dispatch ] = useReducer( feedReducer, {} );
+ return (
+ <>
+
+ dispatch( { type: ACTIONS.PUSH, id, message } ),
+ } }
+ >
+ { children }
+
+
+ { Object.entries( feed )
+ .filter( ( [ , value ] ) => value !== null )
+ .map( ( [ key, { description, ...entry } ] ) => {
+ const contentProps = Array.isArray( description )
+ ? { description }
+ : { children: description };
+ return (
+ {
+ dispatch( { type: ACTIONS.DISMISS, id } );
+ if ( entry.onDismiss ) {
+ entry.onDismiss( id );
+ }
+ } }
+ />
+ );
+ } ) }
+
+ >
+ );
+};
diff --git a/src/app/components/page/index.js b/src/app/components/page/index.js
index 44258df42..47fd63e3c 100644
--- a/src/app/components/page/index.js
+++ b/src/app/components/page/index.js
@@ -1,15 +1,15 @@
-import classNames from "classnames";
+import classNames from 'classnames';
-export const Page = ({ className, children }) => {
- return (
-
- {children}
-
- );
-}
\ No newline at end of file
+export const Page = ( { className, children } ) => {
+ return (
+
+ { children }
+
+ );
+};
diff --git a/src/app/components/section/index.js b/src/app/components/section/index.js
index 75d862ef5..03a4352af 100644
--- a/src/app/components/section/index.js
+++ b/src/app/components/section/index.js
@@ -1,128 +1,159 @@
-import { Button, Title } from "@newfold/ui-component-library";
-import { useState, useEffect} from '@wordpress/element';
-import classNames from "classnames";
+import { Button, Title } from '@newfold/ui-component-library';
+import { useState, useEffect } from '@wordpress/element';
+import classNames from 'classnames';
-export const SectionContainer = ({ className, children }) => {
- return (
-
- {children}
-
- );
-}
+export const SectionContainer = ( { className, children } ) => {
+ return (
+
+ { children }
+
+ );
+};
-export const SectionHeader = ({
- title,
- subTitle,
- className,
- primaryAction = { title: false, className: false, onClick: false },
- secondaryAction = { title: false, className: false, onClick: false }
-}) => {
- return (
-
-
- {title &&
{title} }
- {subTitle &&
{subTitle}
}
-
- {(primaryAction.title || secondaryAction.title) &&
-
- {primaryAction.title &&
-
- {primaryAction.title}
-
- }
- {secondaryAction.title &&
-
- {secondaryAction.title}
-
- }
-
- }
+export const SectionHeader = ( {
+ title,
+ subTitle,
+ className,
+ primaryAction = { title: false, className: false, onClick: false },
+ secondaryAction = { title: false, className: false, onClick: false },
+} ) => {
+ return (
+
+
+ { title && (
+
+ { title }
+
+ ) }
+ { subTitle &&
{ subTitle }
}
+
+ { ( primaryAction.title || secondaryAction.title ) && (
+
+ { primaryAction.title && (
+
+ { primaryAction.title }
+
+ ) }
+ { secondaryAction.title && (
+
+ { secondaryAction.title }
+
+ ) }
+
+ ) }
+
+ );
+};
-
- );
-}
+export const SectionContent = ( {
+ separator = false,
+ id,
+ className,
+ children,
+} ) => {
+ const [ isTarget, setIsTarget ] = useState( false );
+ const searchParams = new URLSearchParams( window.location.search );
-export const SectionContent = ({
- separator = false,
- id,
- className,
- children
-}) => {
- const [isTarget, setIsTarget] = useState(false);
- const searchParams = new URLSearchParams(window.location.search);
+ useEffect( () => {
+ if (
+ searchParams.has( 'nfd-target' ) &&
+ searchParams.get( 'nfd-target' ) === id
+ ) {
+ setIsTarget( true );
- useEffect(() => {
- if (searchParams.has('nfd-target') && searchParams.get('nfd-target') === id) {
- setIsTarget(true);
-
- setTimeout(() => {
- setIsTarget(false);
- removeTargetQueryParam();
- }, 9500);
- }
- }, [searchParams]);
+ setTimeout( () => {
+ setIsTarget( false );
+ removeTargetQueryParam();
+ }, 9500 );
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [ searchParams ] );
- /*
- * Remove the 'nfd-target={id}' query param from the URL
- */
- const removeTargetQueryParam = () => {
- searchParams.delete('nfd-target');
- const currentURL = window.location.href;
- const updatedURL = currentURL.replace(`&nfd-target=${id}`, '');
- window.history.replaceState(null, null, updatedURL);
- }
-
- return (
-
- );
-}
+ /*
+ * Remove the 'nfd-target={id}' query param from the URL
+ */
+ const removeTargetQueryParam = () => {
+ searchParams.delete( 'nfd-target' );
+ const currentURL = window.location.href;
+ const updatedURL = currentURL.replace( `&nfd-target=${ id }`, '' );
+ window.history.replaceState( null, null, updatedURL );
+ };
-export const SectionSettings = ({ className, children, title, description }) => {
- return (
-
-
-
-
- {title}
-
- {description &&
{description}
}
-
-
+ return (
+
+ );
+};
-
- {title}
-
- {children}
-
-
-
- );
-}
\ No newline at end of file
+export const SectionSettings = ( {
+ className,
+ children,
+ title,
+ description,
+} ) => {
+ return (
+
+
+
+
+ { title }
+
+ { description && (
+
{ description }
+ ) }
+
+
+
+
+ { title }
+ { children }
+
+
+ );
+};
diff --git a/src/app/components/site-info/index.js b/src/app/components/site-info/index.js
index bb627c11a..682f89fa5 100644
--- a/src/app/components/site-info/index.js
+++ b/src/app/components/site-info/index.js
@@ -1,62 +1,78 @@
-import { LockClosedIcon, LockOpenIcon } from "@heroicons/react/24/outline";
-import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
-import { Button } from "@newfold/ui-component-library";
-import { BluehostIcon, WordPressIcon } from "../icons";
-import { getPlatformPathUrl, addUtmParams } from "../../util/helpers";
+import { LockClosedIcon, LockOpenIcon } from '@heroicons/react/24/outline';
+import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
+import { Button } from '@newfold/ui-component-library';
+import { BluehostIcon, WordPressIcon } from '../icons';
+import { getPlatformPathUrl, addUtmParams } from '../../util/helpers';
export const SiteInfoBar = () => {
- const { url, title } = NewfoldRuntime.siteDetails;
- const parsedUrl = new URL(url);
- const siteDomain = parsedUrl.hostname;
- const hasSSL = parsedUrl.protocol.includes("https");
- const isWooCommerce = NewfoldRuntime.hasCapability('isEcommerce');
- const isStore = window.location.href.includes('store');
+ const { url, title } = NewfoldRuntime.siteDetails;
+ const parsedUrl = new URL( url );
+ const siteDomain = parsedUrl.hostname;
+ const hasSSL = parsedUrl.protocol.includes( 'https' );
+ const isWooCommerce = NewfoldRuntime.hasCapability( 'isEcommerce' );
+ const isStore = window.location.href.includes( 'store' );
- const renderPadLock = () => {
- if (hasSSL) {
- return
- }
+ const renderPadLock = () => {
+ if ( hasSSL ) {
+ return (
+
+ );
+ }
- return
- }
+ return (
+
+ );
+ };
- return (
-
-
+ return (
+
+
+
+
+ { title }
+
+
+
+ { renderPadLock() }
+
+ { siteDomain }
+
+
+
+
-
-
{title}
-
-
- {renderPadLock()}
- {siteDomain}
-
-
-
-
-
-
-
- Bluehost Account
-
-
-
- {(isWooCommerce && isStore) ? 'View Store' : 'View Site'}
-
-
-
-
-
- );
-}
\ No newline at end of file
+
+
+
+ Bluehost Account
+
+
+
+ { isWooCommerce && isStore
+ ? 'View Store'
+ : 'View Site' }
+
+
+
+
+ );
+};
diff --git a/src/app/components/webinars-banner/index.js b/src/app/components/webinars-banner/index.js
index 7bb7c8bb4..e5a68ced3 100644
--- a/src/app/components/webinars-banner/index.js
+++ b/src/app/components/webinars-banner/index.js
@@ -1,87 +1,108 @@
-import { useState, useEffect } from "@wordpress/element";
-import { Button, Title } from "@newfold/ui-component-library";
-import { ArrowRightIcon, CalendarIcon, ClockIcon } from "@heroicons/react/24/outline";
+import { useState, useEffect } from '@wordpress/element';
+import { Button, Title } from '@newfold/ui-component-library';
+import {
+ ArrowRightIcon,
+ CalendarIcon,
+ ClockIcon,
+} from '@heroicons/react/24/outline';
import { ReactComponent as WebinarsVector } from 'App/images/webinars-vector.svg';
import { SectionContainer, SectionContent } from 'App/components/section';
/**
* A component that displays the next monthly webinar.
- *
+ *
* The component will attempt to fetch the webinars data from the Hiive CDN.
* If the file is fetched successfully, the component will verify the required shape of the data.
* When the data is valid, the component will filter the webinars to only include next webinar.
* The component will then render the next webinar.
- *
+ *
* If any of the above fails the component will not render.
- *
- * @returns JSX.Element
+ *
+ * @return { JSX.Element } The webinars banner component.
*/
const WebinarsBanner = () => {
- const [webinars, setWebinars] = useState([]);
- const [nextWebinar, setNextWebinar] = useState(null);
+ const [ webinars, setWebinars ] = useState( [] );
+ const [ nextWebinar, setNextWebinar ] = useState( null );
- useEffect(() => {
+ useEffect( () => {
fetchWebinars();
- }, []);
+ }, [] );
const fetchWebinars = async () => {
- const webinarsEndpoint = 'https://cdn.hiive.space/resources/bluehost-webinars.json';
+ const webinarsEndpoint =
+ 'https://cdn.hiive.space/resources/bluehost-webinars.json';
- const response = await fetch(webinarsEndpoint);
- if (!response.ok) {
- console.warn('Could not fetch webinars data.');
+ const response = await fetch( webinarsEndpoint );
+ if ( ! response.ok ) {
+ // eslint-disable-next-line no-console
+ console.warn( 'Could not fetch webinars data.' );
return;
}
const data = await response.json();
if (
- data.hasOwnProperty('isActive') &&
+ data.hasOwnProperty( 'isActive' ) &&
data.isActive &&
- data.hasOwnProperty('items') &&
- Array.isArray(data.items) &&
+ data.hasOwnProperty( 'items' ) &&
+ Array.isArray( data.items ) &&
data.items.length > 0
) {
- setWebinars(data.items);
+ setWebinars( data.items );
}
- }
+ };
- useEffect(() => {
- setNextWebinar(getNextWebinar());
- }, [webinars]);
+ useEffect( () => {
+ setNextWebinar( getNextWebinar() );
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [ webinars ] );
const getNextWebinar = () => {
const currentDate = new Date();
- const futureWebinars = webinars.filter(webinar => new Date(webinar.date) > currentDate);
- if (futureWebinars.length === 0) {
+ const futureWebinars = webinars.filter(
+ ( webinar ) => new Date( webinar.date ) > currentDate
+ );
+ if ( futureWebinars.length === 0 ) {
return null;
}
- futureWebinars.sort((a, b) => new Date(a.date) - new Date(b.date));
+ futureWebinars.sort(
+ ( a, b ) => new Date( a.date ) - new Date( b.date )
+ );
- const nextWebinar = futureWebinars[0];
- if (nextWebinar.hasOwnProperty('title') && nextWebinar.title.length > 0) {
+ // eslint-disable-next-line no-shadow
+ const nextWebinar = futureWebinars[ 0 ];
+ if (
+ nextWebinar.hasOwnProperty( 'title' ) &&
+ nextWebinar.title.length > 0
+ ) {
nextWebinar.hasDescription = nextWebinar.description ? true : false;
- nextWebinar.hasTopics = (nextWebinar.hasOwnProperty('topics') && Array.isArray(nextWebinar.topics) && nextWebinar.topics.length > 0) ? true : false;
+ nextWebinar.hasTopics =
+ nextWebinar.hasOwnProperty( 'topics' ) &&
+ Array.isArray( nextWebinar.topics ) &&
+ nextWebinar.topics.length > 0
+ ? true
+ : false;
nextWebinar.hasTime = nextWebinar.time ? true : false;
- nextWebinar.link = nextWebinar.link ?? 'https://www.bluehost.com/blog/events/';
+ nextWebinar.link =
+ nextWebinar.link ?? 'https://www.bluehost.com/blog/events/';
nextWebinar.ctaText = nextWebinar.ctaText ?? 'Register Now';
return nextWebinar;
}
return null;
- }
+ };
- const WebinarListItem = ({ children }) => {
+ const WebinarListItem = ( { children } ) => {
return (
•
- {children}
+ { children }
);
- }
+ };
- if (!nextWebinar) {
+ if ( ! nextWebinar ) {
return null;
}
@@ -94,53 +115,68 @@ const WebinarsBanner = () => {
-
FREE Monthly Webinar: {nextWebinar.title}
+
+ FREE Monthly Webinar: { nextWebinar.title }
+
- {(nextWebinar.hasDescription || nextWebinar.hasTopics) &&
+ { ( nextWebinar.hasDescription ||
+ nextWebinar.hasTopics ) && (
- {nextWebinar.description &&
{nextWebinar.description}
}
- {nextWebinar.topics &&
+ { nextWebinar.description && (
+
+ { nextWebinar.description }
+
+ ) }
+ { nextWebinar.topics && (
<>
-
Topics:
+
+ Topics:
+
- {nextWebinar.topics.map((topic, index) => {topic} )}
+ { nextWebinar.topics.map(
+ ( topic, index ) => (
+
+ { topic }
+
+ )
+ ) }
>
- }
+ ) }
- }
-
+ ) }
- {nextWebinar.date}
+ { nextWebinar.date }
- {nextWebinar.hasTime &&
+ { nextWebinar.hasTime && (
- {nextWebinar.time}
+ { nextWebinar.time }
- }
+ ) }
-
- {nextWebinar.ctaText}
+ { nextWebinar.ctaText }
);
-}
+};
-export default WebinarsBanner;
\ No newline at end of file
+export default WebinarsBanner;
diff --git a/src/app/data/help.js b/src/app/data/help.js
index a3b045214..0184667e9 100644
--- a/src/app/data/help.js
+++ b/src/app/data/help.js
@@ -1,5 +1,5 @@
-import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
-import { getPlatformBaseUrl } from "../util/helpers";
+import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
+import { getPlatformBaseUrl } from '../util/helpers';
const getSupportPhoneNumber = () => {
const brand = NewfoldRuntime.plugin.brand;
@@ -9,13 +9,14 @@ const getSupportPhoneNumber = () => {
}
return '888-401-4678';
-}
+};
const help = [
{
name: 'phone',
title: __( 'Phone', 'wp-plugin-bluehost' ),
+ // eslint-disable-next-line @wordpress/i18n-no-variables
description: __(
- "Contact one of our friendly Customer Care Specialists, as we are waiting to help at " + getSupportPhoneNumber() + ". Open 24 hours - 7 days.",
+ `Contact one of our friendly Customer Care Specialists, as we are waiting to help at ${ getSupportPhoneNumber() }. Open 24 hours - 7 days.`,
'wp-plugin-bluehost'
),
icon: false,
@@ -31,7 +32,9 @@ const help = [
),
icon: false,
cta: __( 'Live Chat', 'wp-plugin-bluehost' ),
- url: getPlatformBaseUrl() + '/contact/?utm_campaign=&utm_content=help_chat_link&utm_term=live_chat&utm_medium=brand_plugin&utm_source=wp-admin/admin.php?page=bluehost#/help',
+ url:
+ getPlatformBaseUrl() +
+ '/contact/?utm_campaign=&utm_content=help_chat_link&utm_term=live_chat&utm_medium=brand_plugin&utm_source=wp-admin/admin.php?page=bluehost#/help',
},
{
name: 'twitter',
@@ -48,7 +51,7 @@ const help = [
name: 'youtube',
title: __( 'YouTube', 'wp-plugin-bluehost' ),
description: __(
- "Find tutorials, answers, interviews and guides on our YouTube channel.",
+ 'Find tutorials, answers, interviews and guides on our YouTube channel.',
'wp-plugin-bluehost'
),
icon: false,
@@ -64,7 +67,9 @@ const help = [
),
icon: false,
cta: __( 'Visit Knowledge Base', 'wp-plugin-bluehost' ),
- url: getPlatformBaseUrl() + '/help/?utm_campaign=&utm_content=help_help_link&utm_term=we_can_help&utm_medium=brand_plugin&utm_source=wp-admin/admin.php?page=bluehost#/help',
+ url:
+ getPlatformBaseUrl() +
+ '/help/?utm_campaign=&utm_content=help_help_link&utm_term=we_can_help&utm_medium=brand_plugin&utm_source=wp-admin/admin.php?page=bluehost#/help',
},
{
name: 'resources',
@@ -75,7 +80,9 @@ const help = [
),
icon: false,
cta: __( 'Explore Resources', 'wp-plugin-bluehost' ),
- url: getPlatformBaseUrl() + '/blog/?utm_campaign=&utm_content=help_kb_link&utm_term=find_answers&utm_medium=brand_plugin&utm_source=wp-admin/admin.php?page=bluehost#/help',
+ url:
+ getPlatformBaseUrl() +
+ '/blog/?utm_campaign=&utm_content=help_kb_link&utm_term=find_answers&utm_medium=brand_plugin&utm_source=wp-admin/admin.php?page=bluehost#/help',
},
{
name: 'events',
diff --git a/src/app/data/routes.js b/src/app/data/routes.js
index 10667cd00..3654e1c00 100644
--- a/src/app/data/routes.js
+++ b/src/app/data/routes.js
@@ -1,12 +1,11 @@
-import {
+import {
HomeIcon,
ShoppingBagIcon,
WrenchScrewdriverIcon,
- BoltIcon,
+ BoltIcon,
AdjustmentsHorizontalIcon,
BuildingStorefrontIcon,
- QuestionMarkCircleIcon }
-from '@heroicons/react/24/outline';
+} from '@heroicons/react/24/outline';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
import { Route, Routes } from 'react-router-dom';
import { __ } from '@wordpress/i18n';
@@ -18,15 +17,15 @@ import Settings from '../pages/settings';
import Staging from '../pages/staging';
import Help from '../pages/help';
import { getMarketplaceSubnavRoutes } from '../../../vendor/newfold-labs/wp-module-marketplace/components/marketplaceSubnav';
-import { ReactComponent as HelpIcon } from "../components/icons/HelpIcon.svg";
+import { ReactComponent as HelpIcon } from '../components/icons/HelpIcon.svg';
-const addPartialMatch = (prefix, path) =>
- prefix === path ? `${prefix}/*` : path;
+const addPartialMatch = ( prefix, path ) =>
+ prefix === path ? `${ prefix }/*` : path;
-const HelpCenterAI = (e) => {
+const HelpCenterAI = ( e ) => {
e.preventDefault();
window.newfoldEmbeddedHelp.toggleNFDLaunchedEmbeddedHelp();
-}
+};
export const AppRoutes = () => {
return (
@@ -38,7 +37,7 @@ export const AppRoutes = () => {
path={ addPartialMatch(
'/marketplace',
addPartialMatch( '/store', page.name )
- )}
+ ) }
element={ }
/>
) ) }
@@ -48,7 +47,10 @@ export const AppRoutes = () => {
element={
- { __( "There's nothing here!", 'wp-plugin-bluehost' ) }
+ { __(
+ "There's nothing here!",
+ 'wp-plugin-bluehost'
+ ) }
}
@@ -84,23 +86,24 @@ export const routes = [
name: '/store/products',
title: __( 'Products & Services', 'wp-plugin-bluehost' ),
},
- NewfoldRuntime.hasCapability( 'hasYithExtended' ) || NewfoldRuntime.hasCapability('canAccessGlobalCTB')
- ? {
- name: "/store/sales_discounts",
- title: __("Sales & Discounts", "wp-plugin-bluehost"),
- }
- : null,
+ NewfoldRuntime.hasCapability( 'hasYithExtended' ) ||
+ NewfoldRuntime.hasCapability( 'canAccessGlobalCTB' )
+ ? {
+ name: '/store/sales_discounts',
+ title: __( 'Sales & Discounts', 'wp-plugin-bluehost' ),
+ }
+ : null,
NewfoldRuntime.isWoo
- ? {
- name: '/store/payments',
- title: __( 'Payments', 'wp-plugin-bluehost' ),
- }
- : null,
+ ? {
+ name: '/store/payments',
+ title: __( 'Payments', 'wp-plugin-bluehost' ),
+ }
+ : null,
{
name: '/store/details',
title: __( 'Store Details', 'wp-plugin-bluehost' ),
},
- ].filter(Boolean),
+ ].filter( Boolean ),
},
{
name: '/marketplace',
@@ -132,7 +135,9 @@ export const routes = [
title: __( 'Help', 'wp-plugin-bluehost' ),
Component: Help,
Icon: HelpIcon,
- action: NewfoldRuntime.hasCapability( 'canAccessHelpCenter' ) ? HelpCenterAI : false,
+ action: NewfoldRuntime.hasCapability( 'canAccessHelpCenter' )
+ ? HelpCenterAI
+ : false,
},
];
diff --git a/src/app/data/store.js b/src/app/data/store.js
index f57ad7e03..64def0fe8 100644
--- a/src/app/data/store.js
+++ b/src/app/data/store.js
@@ -11,7 +11,7 @@ const AppStore = createContext( DEFAULT );
export const bluehostApiFetchSettings = async ( options = {} ) => {
return await apiFetch( {
- url: NewfoldRuntime.createApiUrl('/bluehost/v1/settings'),
+ url: NewfoldRuntime.createApiUrl( '/bluehost/v1/settings' ),
...options,
} );
};
@@ -44,6 +44,7 @@ export const AppStoreProvider = ( { children } ) => {
setError( error );
} );
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [] );
return (
diff --git a/src/app/index.js b/src/app/index.js
index 68aa1b633..3d9c3622f 100644
--- a/src/app/index.js
+++ b/src/app/index.js
@@ -4,7 +4,6 @@ import './tailwind.pcss';
import AppStore, { AppStoreProvider } from './data/store';
import { useLocation, HashRouter as Router } from 'react-router-dom';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
-import { __ } from '@wordpress/i18n';
import { SnackbarList, Spinner } from '@wordpress/components';
import classnames from 'classnames';
import AppRoutes from './data/routes';
@@ -12,13 +11,13 @@ import ErrorCard from './components/errorCard';
import { useDispatch, useSelect } from '@wordpress/data';
import { useEffect } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
+// eslint-disable-next-line import/no-unresolved
import { store as noticesStore } from '@wordpress/notices';
-import { setActiveSubnav } from './util/helpers';
import { kebabCase, filter } from 'lodash';
-import { Root } from "@newfold/ui-component-library";
+import { Root } from '@newfold/ui-component-library';
import { AppNav } from './components/app-nav';
import { SiteInfoBar } from './components/site-info';
-import { NotificationFeed } from './components/notifications/feed';
+import { NotificationFeed } from './components/notifications';
// component sourced from module
import { default as NewfoldNotifications } from '../../vendor/newfold-labs/wp-module-notifications/assets/js/components/notifications/';
@@ -28,9 +27,6 @@ import { addQueryArgs } from '@wordpress/url';
import { useState } from '@wordpress/element';
const Notices = () => {
- if ( 'undefined' === typeof noticesStore ) {
- return null;
- }
const notices = useSelect(
( select ) =>
select( noticesStore )
@@ -39,6 +35,7 @@ const Notices = () => {
[]
);
const { removeNotice } = useDispatch( noticesStore );
+
return (
{
);
};
-const handlePageLoad = () => {
- const location = useLocation();
- const routeContents = document.querySelector( '.wppbh-app-body-inner' );
- useEffect( () => {
- setActiveSubnav( location.pathname );
- window.scrollTo( 0, 0 );
- if ( routeContents ) {
- routeContents.focus( { preventScroll: true } );
- }
- }, [ location.pathname ] );
-};
-
const AppBody = ( props ) => {
const location = useLocation();
const hashedPath = '#' + location.pathname;
const { booted, hasError } = useContext( AppStore );
- handlePageLoad();
-
return (
{
'nfd-w-full nfd-p-4 min-[783px]:nfd-p-0'
) }
>
-
@@ -105,7 +87,7 @@ const AppBody = ( props ) => {
-
+ { 'undefined' !== typeof noticesStore && }
);
diff --git a/src/app/pages/ecommerce/page.js b/src/app/pages/ecommerce/page.js
index f64d14fe0..21e319c14 100644
--- a/src/app/pages/ecommerce/page.js
+++ b/src/app/pages/ecommerce/page.js
@@ -1,45 +1,51 @@
-import { NewfoldECommerce } from "@newfold-labs/wp-module-ecommerce";
-import { useContext } from "@wordpress/element";
-import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
-import { useNotification } from "../../components/notifications/feed";
-import { Page } from "../../components/page";
-import AppStore from "../../data/store";
-import { bluehostSettingsApiFetch } from "../../util/helpers";
-import "./styles.scss";
-import "@newfold-labs/wp-module-ecommerce/bluehost.css";
+import './styles.scss';
+import { useContext } from '@wordpress/element';
+import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
+import { NewfoldECommerce } from '@newfold-labs/wp-module-ecommerce';
+import '@newfold-labs/wp-module-ecommerce/bluehost.css';
+import AppStore from 'App/data/store';
+import { bluehostSettingsApiFetch } from 'App/util/helpers';
+import { Page } from 'App/components/page';
+import { useNotification } from 'App/components/notifications';
const ECommerce = () => {
- const { store, setStore } = useContext(AppStore);
- let [params] = useSearchParams();
- let location = useLocation();
- let navigate = useNavigate();
- let notify = useNotification();
- let state = {
- wp: { comingSoon: store?.comingSoon },
- params,
- location: location.pathname,
- };
- let wpModules = { navigate, notify };
+ const { store, setStore } = useContext( AppStore );
+ const [ params ] = useSearchParams();
+ const location = useLocation();
+ const navigate = useNavigate();
+ const notify = useNotification();
+ const state = {
+ wp: { comingSoon: store?.comingSoon },
+ params,
+ location: location.pathname,
+ };
+ const wpModules = { navigate, notify };
- let actions = {
- toggleComingSoon: () =>
- bluehostSettingsApiFetch(
- { comingSoon: !store.comingSoon },
- console.error,
- (response) => {
- setStore({
- ...store,
- comingSoon: !store.comingSoon,
- });
- }
- ),
- };
+ const actions = {
+ toggleComingSoon: () =>
+ bluehostSettingsApiFetch(
+ { comingSoon: ! store.comingSoon },
+ // eslint-disable-next-line no-console
+ console.error,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setStore( {
+ ...store,
+ comingSoon: ! store.comingSoon,
+ } );
+ }
+ ),
+ };
- return (
-
-
-
- );
+ return (
+
+
+
+ );
};
export default ECommerce;
diff --git a/src/app/pages/example/index.js b/src/app/pages/example/index.js
index 12e2ae61b..d64495801 100644
--- a/src/app/pages/example/index.js
+++ b/src/app/pages/example/index.js
@@ -1,44 +1,86 @@
-import { Button } from "@newfold/ui-component-library";
-import { SectionContainer, SectionHeader, SectionContent } from "../../components/section";
-import { RocketLaunchIcon } from "@heroicons/react/24/outline";
-import { Page } from "../../components/page";
+import { Button } from '@newfold/ui-component-library';
+import {
+ SectionContainer,
+ SectionHeader,
+ SectionContent,
+} from '../../components/section';
+import { RocketLaunchIcon } from '@heroicons/react/24/outline';
+import { Page } from '../../components/page';
const Example = () => {
- return (
-
-
- { console.log('Primary Action Clicked') } }}
- secondaryAction={{ title: 'Secondary Action', onClick: () => { console.log('Secondary Action Clicked') } }}
- />
+ return (
+
+
+ {
+ // eslint-disable-next-line no-console
+ console.log( 'Primary Action Clicked' );
+ },
+ } }
+ secondaryAction={ {
+ title: 'Secondary Action',
+ onClick: () => {
+ // eslint-disable-next-line no-console
+ console.log( 'Secondary Action Clicked' );
+ },
+ } }
+ />
-
-
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
-
-
+
+
+ Lorem Ipsum is simply dummy text of the printing and
+ typesetting industry. Lorem Ipsum has been the industrys
+ standard dummy text ever since the 1500s, when an
+ unknown printer took a galley of type and scrambled it
+ to make a type specimen book. It has survived not only
+ five centuries, but also the leap into electronic
+ typesetting, remaining essentially unchanged.
+
+
-
-
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
-
-
+
+
+ Lorem Ipsum is simply dummy text of the printing and
+ typesetting industry. Lorem Ipsum has been the industrys
+ standard dummy text ever since the 1500s, when an
+ unknown printer took a galley of type and scrambled it
+ to make a type specimen book. It has survived not only
+ five centuries, but also the leap into electronic
+ typesetting, remaining essentially unchanged.
+
+
-
-
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
-
-
- Launch your Site
-
-
-
-
-
- );
-}
+
+
+
+ Lorem Ipsum is simply dummy text of the printing and
+ typesetting industry. Lorem Ipsum has been the
+ industrys standard dummy text ever since the 1500s,
+ when an unknown printer took a galley of type and
+ scrambled it to make a type specimen book.
+
+
+
+ Launch your Site
+
+
+
+
+
+ );
+};
-export default Example;
\ No newline at end of file
+export default Example;
diff --git a/src/app/pages/help/index.js b/src/app/pages/help/index.js
index c5df84caf..fd0961d18 100644
--- a/src/app/pages/help/index.js
+++ b/src/app/pages/help/index.js
@@ -1,34 +1,36 @@
-import { Page } from '../../components/page';
-import { SectionContainer, SectionContent, SectionHeader } from '../../components/section';
-import help from '../../data/help';
-import { Button, Card, Title } from "@newfold/ui-component-library";
+import { Button, Card, Title } from '@newfold/ui-component-library';
+import { Page } from 'App/components/page';
+import {
+ SectionContainer,
+ SectionContent,
+ SectionHeader,
+} from 'App/components/section';
+import help from 'App/data/help';
-const HelpCard = ({ item }) => {
- return (
-
-
- {item.title}
- {item.description}
-
+const HelpCard = ( { item } ) => {
+ return (
+
+
+
+ { item.title }
+
+ { item.description }
+
-
-
- {item.cta}
-
-
-
- );
-}
+
+
+ { item.cta }
+
+
+
+ );
+};
const Help = () => {
const renderHelpCards = () => {
@@ -36,24 +38,24 @@ const Help = () => {
return (
- {helpItems.map((item) => (
-
- ))}
+ { helpItems.map( ( item ) => (
+
+ ) ) }
);
};
return (
-
-
+
+
-
- {renderHelpCards()}
-
+ { renderHelpCards() }
);
diff --git a/src/app/pages/home/accountCard.js b/src/app/pages/home/accountCard.js
index f862cdeec..061249211 100644
--- a/src/app/pages/home/accountCard.js
+++ b/src/app/pages/home/accountCard.js
@@ -1,99 +1,109 @@
import {
- CpuChipIcon,
- CreditCardIcon,
- EnvelopeIcon,
- GiftIcon,
- IdentificationIcon,
- ShieldCheckIcon,
-} from "@heroicons/react/24/outline";
-import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
-import { Card, Title } from "@newfold/ui-component-library";
-import { addUtmParams, getPlatformPathUrl, getPlatformBaseUrl, isJarvis } from "../../util/helpers";
-import classNames from "classnames";
+ CpuChipIcon,
+ CreditCardIcon,
+ EnvelopeIcon,
+ GiftIcon,
+ IdentificationIcon,
+ ShieldCheckIcon,
+} from '@heroicons/react/24/outline';
+import { Card, Title } from '@newfold/ui-component-library';
+import {
+ addUtmParams,
+ getPlatformPathUrl,
+ getPlatformBaseUrl,
+ isJarvis,
+} from '../../util/helpers';
+import classNames from 'classnames';
const base = [
- {
- icon: CpuChipIcon,
- id: "account_link",
- href: addUtmParams( getPlatformPathUrl("hosting/list", "app") ),
- label: isJarvis()
- ? __("Hosting", "bluehost-wordpress-plugin")
- : __("Control Panel", "bluehost-wordpress-plugin"),
- color: "nfd-fill-gray",
- },
- {
- icon: GiftIcon,
- id: "products_link",
- href: addUtmParams( getPlatformPathUrl("renewal-center", "account_center#products") ),
- label: isJarvis()
- ? __("Renewal Center", "bluehost-wordpress-plugin")
- : __("Products", "bluehost-wordpress-plugin"),
- color: "nfd-fill-primary-dark",
- },
- {
- icon: CreditCardIcon,
- id: "billing_link",
- href: addUtmParams( getPlatformPathUrl("billing-center", "account_center#billing") ),
- label: isJarvis()
- ? __("Payment Methods", "bluehost-wordpress-plugin")
- : __("Billing", "bluehost-wordpress-plugin"),
- color: "nfd-fill-primary",
- },
- {
- icon: EnvelopeIcon,
- id: "mail_link",
- href: addUtmParams( getPlatformPathUrl("home", "app#/email-office") ),
- label: isJarvis()
- ? __("Mail", "bluehost-wordpress-plugin")
- : __("Mail & Office", "bluehost-wordpress-plugin"),
- color: "nfd-fill-[#5b5b5b]",
- },
- {
- icon: ShieldCheckIcon,
- id: "security_link",
- href: addUtmParams( getPlatformPathUrl("account-center", "account_center#security") ),
- label: __("Security", "bluehost-wordpress-plugin"),
- color: "nfd-fill-[#17b212]",
- },
- {
- icon: IdentificationIcon,
- id: "validation_token_link",
- href: isJarvis()
- ? addUtmParams( getPlatformPathUrl("account-center") )
- : addUtmParams( getPlatformBaseUrl("/cgi/token") ),
- label: isJarvis()
- ? __("Profile", "bluehost-wordpress-plugin")
- : __("Validation Token", "bluehost-wordpress-plugin"),
- color: "nfd-fill-[#f89c24]",
- },
+ {
+ icon: CpuChipIcon,
+ id: 'account_link',
+ href: addUtmParams( getPlatformPathUrl( 'hosting/list', 'app' ) ),
+ label: isJarvis()
+ ? __( 'Hosting', 'bluehost-wordpress-plugin' )
+ : __( 'Control Panel', 'bluehost-wordpress-plugin' ),
+ color: 'nfd-fill-gray',
+ },
+ {
+ icon: GiftIcon,
+ id: 'products_link',
+ href: addUtmParams(
+ getPlatformPathUrl( 'renewal-center', 'account_center#products' )
+ ),
+ label: isJarvis()
+ ? __( 'Renewal Center', 'bluehost-wordpress-plugin' )
+ : __( 'Products', 'bluehost-wordpress-plugin' ),
+ color: 'nfd-fill-primary-dark',
+ },
+ {
+ icon: CreditCardIcon,
+ id: 'billing_link',
+ href: addUtmParams(
+ getPlatformPathUrl( 'billing-center', 'account_center#billing' )
+ ),
+ label: isJarvis()
+ ? __( 'Payment Methods', 'bluehost-wordpress-plugin' )
+ : __( 'Billing', 'bluehost-wordpress-plugin' ),
+ color: 'nfd-fill-primary',
+ },
+ {
+ icon: EnvelopeIcon,
+ id: 'mail_link',
+ href: addUtmParams( getPlatformPathUrl( 'home', 'app#/email-office' ) ),
+ label: isJarvis()
+ ? __( 'Mail', 'bluehost-wordpress-plugin' )
+ : __( 'Mail & Office', 'bluehost-wordpress-plugin' ),
+ color: 'nfd-fill-[#5b5b5b]',
+ },
+ {
+ icon: ShieldCheckIcon,
+ id: 'security_link',
+ href: addUtmParams(
+ getPlatformPathUrl( 'account-center', 'account_center#security' )
+ ),
+ label: __( 'Security', 'bluehost-wordpress-plugin' ),
+ color: 'nfd-fill-[#17b212]',
+ },
+ {
+ icon: IdentificationIcon,
+ id: 'validation_token_link',
+ href: isJarvis()
+ ? addUtmParams( getPlatformPathUrl( 'account-center' ) )
+ : addUtmParams( getPlatformBaseUrl( '/cgi/token' ) ),
+ label: isJarvis()
+ ? __( 'Profile', 'bluehost-wordpress-plugin' )
+ : __( 'Validation Token', 'bluehost-wordpress-plugin' ),
+ color: 'nfd-fill-[#f89c24]',
+ },
];
-export function AccountCard(props) {
- return (
-
-
- Bluehost Account
-
-
-
- );
-}
+export const AccountCard = ( { props } ) => {
+ return (
+
+
+ Bluehost Account
+
+
+
+ );
+};
diff --git a/src/app/pages/home/freeAddonsSection.js b/src/app/pages/home/freeAddonsSection.js
index 2518f6f5f..2aa9f50be 100644
--- a/src/app/pages/home/freeAddonsSection.js
+++ b/src/app/pages/home/freeAddonsSection.js
@@ -1,7 +1,7 @@
-import { FreePlugins } from "@newfold-labs/wp-module-ecommerce";
-import { useNotification } from "../../components/notifications/feed";
+import { FreePlugins } from '@newfold-labs/wp-module-ecommerce';
+import { useNotification } from 'App/components/notifications';
-export function FreeAddonsSection() {
- let notify = useNotification();
- return ;
-}
+export const FreeAddonsSection = ( { props } ) => {
+ const notify = useNotification();
+ return ;
+};
diff --git a/src/app/pages/home/helpCard.js b/src/app/pages/home/helpCard.js
index a3ee28006..c7829c2db 100644
--- a/src/app/pages/home/helpCard.js
+++ b/src/app/pages/home/helpCard.js
@@ -1,26 +1,31 @@
-import { Button, Card, Title } from "@newfold/ui-component-library";
-import SupportIllustration from "../../images/section-home-help-me.svg";
+import { Button, Card, Title } from '@newfold/ui-component-library';
+import SupportIllustration from '../../images/section-home-help-me.svg';
export function HelpCard() {
- return (
-
-
- Need some help?
-
-
-
From DIY to full-service help.
-
- Call or chat 24/7 for support or let our experts build your site for
- you.
-
-
- Help me
-
-
-
-
- );
+ return (
+
+
+ Need some help?
+
+
+
From DIY to full-service help.
+
+ Call or chat 24/7 for support or let our experts build
+ your site for you.
+
+
+ Help me
+
+
+
+
+ );
}
diff --git a/src/app/pages/home/index.js b/src/app/pages/home/index.js
index 7df5f3d50..6b7efae6c 100644
--- a/src/app/pages/home/index.js
+++ b/src/app/pages/home/index.js
@@ -12,7 +12,7 @@ const Home = () => {
-
+
diff --git a/src/app/pages/home/welcomeSection.js b/src/app/pages/home/welcomeSection.js
index 002dce3eb..d5540304c 100644
--- a/src/app/pages/home/welcomeSection.js
+++ b/src/app/pages/home/welcomeSection.js
@@ -1,23 +1,24 @@
-import { OnboardingScreen } from "@newfold-labs/wp-module-ecommerce";
-import { useContext } from "@wordpress/element";
-import { useNotification } from "../../components/notifications/feed";
-import AppStore from "../../data/store";
-import { bluehostSettingsApiFetch } from "../../util/helpers";
+import { useContext } from '@wordpress/element';
+import { OnboardingScreen } from '@newfold-labs/wp-module-ecommerce';
+import AppStore from 'App/data/store';
+import { bluehostSettingsApiFetch } from 'App/util/helpers';
+import { useNotification } from 'App/components/notifications';
export function WelcomeSection() {
- let { store, setStore } = useContext(AppStore);
- let notify = useNotification();
- const toggleComingSoon = () =>
- bluehostSettingsApiFetch(
- { comingSoon: !store.comingSoon },
- console.error,
- () => setStore({ ...store, comingSoon: !store.comingSoon })
- );
- return (
-
- );
+ const { store, setStore } = useContext( AppStore );
+ const notify = useNotification();
+ const toggleComingSoon = () =>
+ bluehostSettingsApiFetch(
+ { comingSoon: ! store.comingSoon },
+ // eslint-disable-next-line no-console
+ console.error,
+ () => setStore( { ...store, comingSoon: ! store.comingSoon } )
+ );
+ return (
+
+ );
}
diff --git a/src/app/pages/marketplace/index.js b/src/app/pages/marketplace/index.js
index 97d5fc920..40e929ff1 100644
--- a/src/app/pages/marketplace/index.js
+++ b/src/app/pages/marketplace/index.js
@@ -2,54 +2,64 @@ import apiFetch from '@wordpress/api-fetch';
import { useState, useEffect } from '@wordpress/element';
import { useLocation } from 'react-router-dom';
import classnames from 'classnames';
-import { Page } from "../../components/page";
-import { SectionContainer, SectionHeader, SectionContent } from "../../components/section";
-import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
+import { Page } from 'App/components/page';
+import {
+ SectionContainer,
+ SectionHeader,
+ SectionContent,
+} from 'App/components/section';
+import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
// component sourced from marketplace module
import { default as NewfoldMarketplace } from '../../../../vendor/newfold-labs/wp-module-marketplace/components/marketplace/';
const MarketplacePage = () => {
-
- // constants to pass to module
- const moduleConstants = {
- 'supportsCTB': true,
- 'text': {
- 'title': __('Marketplace', 'bluehost-wordpress-plugin'),
- 'subTitle': __('Explore our featured collection of tools and services.', 'bluehost-wordpress-plugin'),
- 'error': __('Oops, there was an error loading the marketplace, please try again later.', 'bluehost-wordpress-plugin'),
- 'noProducts': __('Sorry, no marketplace items. Please, try again later.', 'bluehost-wordpress-plugin'),
- 'loadMore': __('Load More', 'bluehost-wordpress-plugin'),
- }
+ // constants to pass to module
+ const moduleConstants = {
+ supportsCTB: true,
+ text: {
+ title: __( 'Marketplace', 'bluehost-wordpress-plugin' ),
+ subTitle: __(
+ 'Explore our featured collection of tools and services.',
+ 'bluehost-wordpress-plugin'
+ ),
+ error: __(
+ 'Oops, there was an error loading the marketplace, please try again later.',
+ 'bluehost-wordpress-plugin'
+ ),
+ noProducts: __(
+ 'Sorry, no marketplace items. Please, try again later.',
+ 'bluehost-wordpress-plugin'
+ ),
+ loadMore: __( 'Load More', 'bluehost-wordpress-plugin' ),
+ },
};
- // methods to pass to module
- const moduleMethods = {
- apiFetch,
- classnames,
- useState,
- useEffect,
- useLocation,
- NewfoldRuntime,
- };
+ // methods to pass to module
+ const moduleMethods = {
+ apiFetch,
+ classnames,
+ useState,
+ useEffect,
+ useLocation,
+ NewfoldRuntime,
+ };
const moduleComponents = {
SectionHeader,
SectionContent,
- }
-
- return (
-
-
-
-
+ };
-
-
- );
+ return (
+
+
+
+
+
+ );
};
-export default MarketplacePage;
\ No newline at end of file
+export default MarketplacePage;
diff --git a/src/app/pages/performance/index.js b/src/app/pages/performance/index.js
index 3a4f7ec34..33dfc9d97 100644
--- a/src/app/pages/performance/index.js
+++ b/src/app/pages/performance/index.js
@@ -4,59 +4,66 @@ import { useState, useEffect, useContext, Fragment } from '@wordpress/element';
import apiFetch from '@wordpress/api-fetch';
import classnames from 'classnames';
import { useUpdateEffect } from 'react-use';
-import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
-import { SectionContainer, SectionHeader, SectionContent, SectionSettings } from '../../components/section';
-import { useNotification } from '../../components/notifications/feed';
-import {
- bluehostSettingsApiFetch as newfoldSettingsApiFetch,
- bluehostPurgeCacheApiFetch as newfoldPurgeCacheApiFetch
-} from '../../util/helpers';
+import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
+import {
+ SectionContainer,
+ SectionHeader,
+ SectionContent,
+ SectionSettings,
+} from 'App/components/section';
+import { useNotification } from 'App/components/notifications';
+import {
+ bluehostSettingsApiFetch as newfoldSettingsApiFetch,
+ bluehostPurgeCacheApiFetch as newfoldPurgeCacheApiFetch,
+} from 'App/util/helpers';
import { default as NewfoldPerformance } from '../../../../vendor/newfold-labs/wp-module-performance/components/performance/';
const PerformancePage = () => {
+ // constants to pass to module
+ const moduleConstants = {};
- // constants to pass to module
- const moduleConstants = {};
-
- // methods to pass to module
- const moduleMethods = {
- apiFetch,
- classnames,
- useState,
- useEffect,
- useContext,
- NewfoldRuntime,
- useNotification,
- newfoldSettingsApiFetch,
- newfoldPurgeCacheApiFetch,
- useUpdateEffect,
- AppStore,
- };
+ // methods to pass to module
+ const moduleMethods = {
+ apiFetch,
+ classnames,
+ useState,
+ useEffect,
+ useContext,
+ NewfoldRuntime,
+ useNotification,
+ newfoldSettingsApiFetch,
+ newfoldPurgeCacheApiFetch,
+ useUpdateEffect,
+ AppStore,
+ };
const moduleComponents = {
Page,
- SectionHeader,
+ SectionHeader,
SectionContent,
- SectionSettings,
- SectionContainer,
- Fragment,
- }
+ SectionSettings,
+ SectionContainer,
+ Fragment,
+ };
return (
-
-
-
-
-
+
+
+
+
+
);
};
diff --git a/src/app/pages/settings/automaticUpdates.js b/src/app/pages/settings/automaticUpdates.js
index 6ef9a85f2..0758c2fa2 100644
--- a/src/app/pages/settings/automaticUpdates.js
+++ b/src/app/pages/settings/automaticUpdates.js
@@ -1,284 +1,323 @@
+import { useState } from '@wordpress/element';
+import { useUpdateEffect } from 'react-use';
+import { Alert, ToggleField } from '@newfold/ui-component-library';
import AppStore from '../../data/store';
import { bluehostSettingsApiFetch } from '../../util/helpers';
-import { useUpdateEffect } from 'react-use';
-import { useState } from '@wordpress/element';
-import { Alert, ToggleField } from "@newfold/ui-component-library";
-import { SectionSettings } from "../../components/section";
-import { useNotification } from '../../components/notifications/feed';
+import { SectionSettings } from 'App/components/section';
+import { useNotification } from 'App/components/notifications';
-const AutomaticUpdatesAll = ({ setError, notify }) => {
- const { store, setStore } = useContext(AppStore);
- const [autoUpdatesAll, setAutoUpdatesAll] = useState(
+const AutomaticUpdatesAll = ( { setError, notify } ) => {
+ const { store, setStore } = useContext( AppStore );
+ const [ autoUpdatesAll, setAutoUpdatesAll ] = useState(
store.autoUpdatesMajorCore &&
- store.autoUpdatesPlugins &&
- store.autoUpdatesThemes
- ? true
- : false
+ store.autoUpdatesPlugins &&
+ store.autoUpdatesThemes
+ ? true
+ : false
);
const getAllNoticeTitle = () => {
return autoUpdatesAll
- ? __('Enabled All auto-updates', 'wp-plugin-bluehost')
- : __('Disabled All auto-updates', 'wp-plugin-bluehost');
+ ? __( 'Enabled All auto-updates', 'wp-plugin-bluehost' )
+ : __( 'Disabled All auto-updates', 'wp-plugin-bluehost' );
};
const getAllNoticeText = () => {
return autoUpdatesAll
- ? __('Everything will automatically update.', 'wp-plugin-bluehost')
- : __('Custom auto-update settings.', 'wp-plugin-bluehost');
+ ? __(
+ 'Everything will automatically update.',
+ 'wp-plugin-bluehost'
+ )
+ : __( 'Custom auto-update settings.', 'wp-plugin-bluehost' );
};
const toggleAutoUpdatesAll = () => {
- if ( autoUpdatesAll ) { // is unchecking
+ if ( autoUpdatesAll ) {
+ // is unchecking
// just uncheck this one
- setAutoUpdatesAll(!autoUpdatesAll);
- } else { // is checking
+ setAutoUpdatesAll( ! autoUpdatesAll );
+ } else {
+ // is checking
bluehostSettingsApiFetch(
- {
+ {
autoUpdatesMajorCore: true,
autoUpdatesPlugins: true,
- autoUpdatesThemes: true
- },
- setError,
- (response) => {
- setAutoUpdatesAll(!autoUpdatesAll);
+ autoUpdatesThemes: true,
+ },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setAutoUpdatesAll( ! autoUpdatesAll );
}
);
}
};
const notifySuccess = () => {
- notify.push("everything-autoupdate-notice", {
+ notify.push( 'everything-autoupdate-notice', {
title: getAllNoticeTitle(),
- description: (
-
- {getAllNoticeText()}
-
- ),
- variant: "success",
+ description: { getAllNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
useEffect( () => {
- if ( store.autoUpdatesMajorCore && store.autoUpdatesPlugins && store.autoUpdatesThemes ) {
+ if (
+ store.autoUpdatesMajorCore &&
+ store.autoUpdatesPlugins &&
+ store.autoUpdatesThemes
+ ) {
setAutoUpdatesAll( true );
} else {
setAutoUpdatesAll( false );
}
- }, [ store.autoUpdatesMajorCore, store.autoUpdatesPlugins, store.autoUpdatesThemes ] );
-
- useUpdateEffect(() => {
-
- setStore({
+ }, [
+ store.autoUpdatesMajorCore,
+ store.autoUpdatesPlugins,
+ store.autoUpdatesThemes,
+ ] );
+
+ useUpdateEffect( () => {
+ setStore( {
...store,
autoUpdatesAll,
- });
+ } );
notifySuccess();
- }, [autoUpdatesAll]);
+ }, [ autoUpdatesAll ] );
return (
);
-}
+};
-const AutomaticUpdatesMajorCore = ({ setError, notify }) => {
- const { store, setStore } = useContext(AppStore);
- const [autoUpdatesMajorCore, setAutoUpdatesCore] = useState(
+const AutomaticUpdatesMajorCore = ( { setError, notify } ) => {
+ const { store, setStore } = useContext( AppStore );
+ const [ autoUpdatesMajorCore, setAutoUpdatesCore ] = useState(
store.autoUpdatesMajorCore
);
const getCoreNoticeTitle = () => {
return autoUpdatesMajorCore
- ? __('Enabled Core auto-updates', 'wp-plugin-bluehost')
- : __('Disabled Core auto-updates', 'wp-plugin-bluehost');
+ ? __( 'Enabled Core auto-updates', 'wp-plugin-bluehost' )
+ : __( 'Disabled Core auto-updates', 'wp-plugin-bluehost' );
};
const getCoreNoticeText = () => {
return autoUpdatesMajorCore
- ? __('WordPress will automatically update.', 'wp-plugin-bluehost')
- : __('WordPress must be manually updated.', 'wp-plugin-bluehost');
+ ? __( 'WordPress will automatically update.', 'wp-plugin-bluehost' )
+ : __( 'WordPress must be manually updated.', 'wp-plugin-bluehost' );
};
const toggleAutoUpdatesMajorCore = () => {
- bluehostSettingsApiFetch({ autoUpdatesMajorCore: !autoUpdatesMajorCore }, setError, (response) => {
- setAutoUpdatesCore(!autoUpdatesMajorCore);
- });
+ bluehostSettingsApiFetch(
+ { autoUpdatesMajorCore: ! autoUpdatesMajorCore },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setAutoUpdatesCore( ! autoUpdatesMajorCore );
+ }
+ );
};
const notifySuccess = () => {
- notify.push("major-core-autoupdate-notice", {
+ notify.push( 'major-core-autoupdate-notice', {
title: getCoreNoticeTitle(),
- description: (
-
- {getCoreNoticeText()}
-
- ),
- variant: "success",
+ description: { getCoreNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
- useUpdateEffect(() => {
- setStore({
+ useUpdateEffect( () => {
+ setStore( {
...store,
autoUpdatesMajorCore,
- });
+ } );
notifySuccess();
- }, [autoUpdatesMajorCore]);
+ }, [ autoUpdatesMajorCore ] );
return (
);
-}
+};
-const AutomaticUpdatesPlugins = ({ setError, notify }) => {
- const { store, setStore } = useContext(AppStore);
- const [autoUpdatesPlugins, setAutoUpdatesPlugins] = useState(
+const AutomaticUpdatesPlugins = ( { setError, notify } ) => {
+ const { store, setStore } = useContext( AppStore );
+ const [ autoUpdatesPlugins, setAutoUpdatesPlugins ] = useState(
store.autoUpdatesPlugins
);
const getPluginsNoticeTitle = () => {
return autoUpdatesPlugins
- ? __('Enabled Plugins auto-update', 'wp-plugin-bluehost')
- : __('Disabled Plugins auto-update', 'wp-plugin-bluehost');
+ ? __( 'Enabled Plugins auto-update', 'wp-plugin-bluehost' )
+ : __( 'Disabled Plugins auto-update', 'wp-plugin-bluehost' );
};
const getPluginsNoticeText = () => {
return autoUpdatesPlugins
- ? __('All plugins will automatically update.', 'wp-plugin-bluehost')
- : __('Each plugin must be manually updated.', 'wp-plugin-bluehost');
+ ? __(
+ 'All plugins will automatically update.',
+ 'wp-plugin-bluehost'
+ )
+ : __(
+ 'Each plugin must be manually updated.',
+ 'wp-plugin-bluehost'
+ );
};
const toggleAutoUpdatesPlugins = () => {
- bluehostSettingsApiFetch({ autoUpdatesPlugins: !autoUpdatesPlugins }, setError, (response) => {
- setAutoUpdatesPlugins(!autoUpdatesPlugins);
- });
+ bluehostSettingsApiFetch(
+ { autoUpdatesPlugins: ! autoUpdatesPlugins },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setAutoUpdatesPlugins( ! autoUpdatesPlugins );
+ }
+ );
};
const notifySuccess = () => {
- notify.push("plugins-autoupdate-notice", {
+ notify.push( 'plugins-autoupdate-notice', {
title: getPluginsNoticeTitle(),
- description: (
-
- {getPluginsNoticeText()}
-
- ),
- variant: "success",
+ description: { getPluginsNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
- useUpdateEffect(() => {
- setStore({
+ useUpdateEffect( () => {
+ setStore( {
...store,
autoUpdatesPlugins,
- });
+ } );
notifySuccess();
- }, [autoUpdatesPlugins]);
+ }, [ autoUpdatesPlugins ] );
return (
);
-}
+};
-const AutomaticUpdatesThemes = ({ setError, notify }) => {
- const { store, setStore } = useContext(AppStore);
- const [autoUpdatesThemes, setAutoUpdatesThemes] = useState(
+const AutomaticUpdatesThemes = ( { setError, notify } ) => {
+ const { store, setStore } = useContext( AppStore );
+ const [ autoUpdatesThemes, setAutoUpdatesThemes ] = useState(
store.autoUpdatesThemes
);
const getThemesNoticeTitle = () => {
return autoUpdatesThemes
- ? __('Enabled Themes auto-update', 'wp-plugin-bluehost')
- : __('Disabled Themes auto-update', 'wp-plugin-bluehost');
+ ? __( 'Enabled Themes auto-update', 'wp-plugin-bluehost' )
+ : __( 'Disabled Themes auto-update', 'wp-plugin-bluehost' );
};
const getThemesNoticeText = () => {
return autoUpdatesThemes
- ? __('All themes will automatically update.', 'wp-plugin-bluehost')
- : __('Each theme must be manually updated.', 'wp-plugin-bluehost');
+ ? __(
+ 'All themes will automatically update.',
+ 'wp-plugin-bluehost'
+ )
+ : __(
+ 'Each theme must be manually updated.',
+ 'wp-plugin-bluehost'
+ );
};
const toggleAutoUpdatesThemes = () => {
- bluehostSettingsApiFetch({ autoUpdatesThemes: !autoUpdatesThemes }, setError, (response) => {
- setAutoUpdatesThemes(!autoUpdatesThemes);
- });
+ bluehostSettingsApiFetch(
+ { autoUpdatesThemes: ! autoUpdatesThemes },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setAutoUpdatesThemes( ! autoUpdatesThemes );
+ }
+ );
};
const notifySuccess = () => {
- notify.push("themes-autoupdate-notice", {
+ notify.push( 'themes-autoupdate-notice', {
title: getThemesNoticeTitle(),
- description: (
-
- {getThemesNoticeText()}
-
- ),
- variant: "success",
+ description: { getThemesNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
- useUpdateEffect(() => {
- setStore({
+ useUpdateEffect( () => {
+ setStore( {
...store,
autoUpdatesThemes,
- });
+ } );
notifySuccess();
- }, [autoUpdatesThemes]);
+ }, [ autoUpdatesThemes ] );
return (
);
-}
+};
const AutomaticUpdates = () => {
- const [isError, setError] = useState(false);
+ const [ isError, setError ] = useState( false );
- let notify = useNotification();
+ const notify = useNotification();
return (
-
-
-
-
- {isError &&
+
+
+
+
+ { isError && (
- {__('Oops! Something went wrong. Please try again.', 'wp-plugin-bluehost')}
+ { __(
+ 'Oops! Something went wrong. Please try again.',
+ 'wp-plugin-bluehost'
+ ) }
- }
+ ) }
);
-}
+};
-export default AutomaticUpdates;
\ No newline at end of file
+export default AutomaticUpdates;
diff --git a/src/app/pages/settings/comingSoon.js b/src/app/pages/settings/comingSoon.js
index e77a57ba2..de0d710cd 100644
--- a/src/app/pages/settings/comingSoon.js
+++ b/src/app/pages/settings/comingSoon.js
@@ -1,115 +1,131 @@
+import { useState } from '@wordpress/element';
+import { useUpdateEffect } from 'react-use';
+import { Alert, ToggleField } from '@newfold/ui-component-library';
import AppStore from '../../data/store';
import {
bluehostSettingsApiFetch,
comingSoonAdminbarToggle,
} from '../../util/helpers';
-import { useState } from '@wordpress/element';
-import { useUpdateEffect } from 'react-use';
-import { Alert, ToggleField } from "@newfold/ui-component-library";
-import { SectionSettings } from "../../components/section";
-import { useNotification } from '../../components/notifications/feed';
+import { SectionSettings } from 'App/components/section';
+import { useNotification } from 'App/components/notifications';
const ComingSoon = () => {
- const { store, setStore } = useContext(AppStore);
- const [comingSoon, setComingSoon] = useState(store.comingSoon);
- const [isError, setError] = useState(false);
+ const { store, setStore } = useContext( AppStore );
+ const [ comingSoon, setComingSoon ] = useState( store.comingSoon );
+ const [ isError, setError ] = useState( false );
- let notify = useNotification();
+ const notify = useNotification();
const getComingSoonNoticeTitle = () => {
return comingSoon
- ? __('Coming soon activated', 'wp-plugin-bluehost')
- : __('Coming soon deactivated', 'wp-plugin-bluehost');
+ ? __( 'Coming soon activated', 'wp-plugin-bluehost' )
+ : __( 'Coming soon deactivated', 'wp-plugin-bluehost' );
};
const getComingSoonNoticeText = () => {
return comingSoon
? __(
- 'Coming soon page is active. Site requires login.',
- 'wp-plugin-bluehost'
- )
+ 'Coming soon page is active. Site requires login.',
+ 'wp-plugin-bluehost'
+ )
: __(
- 'Coming soon page is not active. Site is live to visitors.',
- 'wp-plugin-bluehost'
- );
+ 'Coming soon page is not active. Site is live to visitors.',
+ 'wp-plugin-bluehost'
+ );
};
const toggleComingSoon = () => {
- bluehostSettingsApiFetch({ comingSoon: !comingSoon }, setError, (response) => {
- setComingSoon(!comingSoon);
- });
+ bluehostSettingsApiFetch(
+ { comingSoon: ! comingSoon },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setComingSoon( ! comingSoon );
+ }
+ );
};
const notifySuccess = () => {
- notify.push("coming-soon-toggle-notice", {
+ notify.push( 'coming-soon-toggle-notice', {
title: getComingSoonNoticeTitle(),
- description: (
-
- {getComingSoonNoticeText()}
-
- ),
- variant: "success",
+ description: { getComingSoonNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
- useUpdateEffect(() => {
- setStore({
+ useUpdateEffect( () => {
+ setStore( {
...store,
comingSoon,
- });
+ } );
notifySuccess();
- comingSoonAdminbarToggle(comingSoon);
- }, [comingSoon]);
+ comingSoonAdminbarToggle( comingSoon );
+ }, [ comingSoon ] );
const getComingSoonSectionTitle = () => {
const getStatus = () => {
- return (
- comingSoon
- ? {__('Coming Soon', 'wp-plugin-bluehost')}
- : {__('Live', 'wp-plugin-bluehost')}
+ return comingSoon ? (
+
+ { __( 'Coming Soon', 'wp-plugin-bluehost' ) }
+
+ ) : (
+
+ { __( 'Live', 'wp-plugin-bluehost' ) }
+
);
};
return (
- {__('Site Status', 'wp-plugin-bluehost')}: {getStatus()}
- )
+
+ { __( 'Site Status', 'wp-plugin-bluehost' ) }: { getStatus() }
+
+ );
};
return (
{
+ ) }
+ checked={ comingSoon }
+ onChange={ () => {
toggleComingSoon();
- }}
+ } }
/>
- {comingSoon &&
+ { comingSoon && (
- {__('Your website is currently displaying a "Coming Soon" page.', 'wp-plugin-bluehost')}
+ { __(
+ 'Your website is currently displaying a "Coming Soon" page.',
+ 'wp-plugin-bluehost'
+ ) }
- }
+ ) }
- {isError &&
+ { isError && (
- {__('Oops! Something went wrong. Please try again.', 'wp-plugin-bluehost')}
+ { __(
+ 'Oops! Something went wrong. Please try again.',
+ 'wp-plugin-bluehost'
+ ) }
- }
+ ) }
);
-}
+};
-export default ComingSoon;
\ No newline at end of file
+export default ComingSoon;
diff --git a/src/app/pages/settings/commentSettings.js b/src/app/pages/settings/commentSettings.js
index 27f6475f4..fdd66e3a5 100644
--- a/src/app/pages/settings/commentSettings.js
+++ b/src/app/pages/settings/commentSettings.js
@@ -1,137 +1,150 @@
+import { useState } from '@wordpress/element';
+import { useUpdateEffect } from 'react-use';
+import { Alert, SelectField, ToggleField } from '@newfold/ui-component-library';
import AppStore from '../../data/store';
import { bluehostSettingsApiFetch } from '../../util/helpers';
-import { useUpdateEffect } from 'react-use';
-import { useState } from '@wordpress/element';
-import { Alert, SelectField, ToggleField } from "@newfold/ui-component-library";
-import { SectionSettings } from "../../components/section";
-import { useNotification } from '../../components/notifications/feed';
+import { SectionSettings } from 'App/components/section';
+import { useNotification } from 'App/components/notifications';
-const OldPostsComments = ({ setError, notify }) => {
- const { store, setStore } = useContext(AppStore);
- const [disableCommentsOldPosts, setDisableCommentsOldPosts] = useState(
+const OldPostsComments = ( { setError, notify } ) => {
+ const { store, setStore } = useContext( AppStore );
+ const [ disableCommentsOldPosts, setDisableCommentsOldPosts ] = useState(
store.disableCommentsOldPosts
);
const disableCommentsNoticeTitle = () => {
return disableCommentsOldPosts
- ? __('Disabled old post comments', 'wp-plugin-bluehost')
- : __('Enabled old post comments', 'wp-plugin-bluehost');
+ ? __( 'Disabled old post comments', 'wp-plugin-bluehost' )
+ : __( 'Enabled old post comments', 'wp-plugin-bluehost' );
};
const disableCommentsNoticeText = () => {
return disableCommentsOldPosts
- ? __('Comments on old posts are disabled.', 'wp-plugin-bluehost')
- : __('Comments are allowed on old posts.', 'wp-plugin-bluehost');
+ ? __( 'Comments on old posts are disabled.', 'wp-plugin-bluehost' )
+ : __( 'Comments are allowed on old posts.', 'wp-plugin-bluehost' );
};
const toggleDisableCommentsOldPosts = () => {
- bluehostSettingsApiFetch({ disableCommentsOldPosts: !disableCommentsOldPosts }, setError, (response) => {
- setDisableCommentsOldPosts(!disableCommentsOldPosts);
- });
+ bluehostSettingsApiFetch(
+ { disableCommentsOldPosts: ! disableCommentsOldPosts },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setDisableCommentsOldPosts( ! disableCommentsOldPosts );
+ }
+ );
};
const notifySuccess = () => {
- notify.push("disable-old-posts-comments-notice", {
+ notify.push( 'disable-old-posts-comments-notice', {
title: disableCommentsNoticeTitle(),
- description: (
-
- {disableCommentsNoticeText()}
-
- ),
- variant: "success",
+ description: { disableCommentsNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
- useUpdateEffect(() => {
- setStore({
+ useUpdateEffect( () => {
+ setStore( {
...store,
disableCommentsOldPosts,
- });
+ } );
notifySuccess();
- }, [disableCommentsOldPosts]);
+ }, [ disableCommentsOldPosts ] );
return (
);
-}
+};
-const CloseCommentsDays = ({ setError, notify }) => {
- const { store, setStore } = useContext(AppStore);
- const [closeCommentsDays, setNumCloseCommentsDays] = useState(
+const CloseCommentsDays = ( { setError, notify } ) => {
+ const { store, setStore } = useContext( AppStore );
+ const [ closeCommentsDays, setNumCloseCommentsDays ] = useState(
store.closeCommentsDays
);
const closeCommentsDaysNoticeTitle = () => {
- return (
- __('Comments setting saved ', 'wp-plugin-bluehost')
- );
+ return __( 'Comments setting saved ', 'wp-plugin-bluehost' );
};
const closeCommentsDaysNoticeText = () => {
//`Comments on posts are disabled after ${closeCommentsDays} days.`
return (
- __('Comments on posts are disabled after ', 'wp-plugin-bluehost') +
+ __(
+ 'Comments on posts are disabled after ',
+ 'wp-plugin-bluehost'
+ ) +
closeCommentsDays +
- _n(' day.', ' days.', parseInt(closeCommentsDays), 'wp-plugin-bluehost')
+ _n(
+ ' day.',
+ ' days.',
+ parseInt( closeCommentsDays ),
+ 'wp-plugin-bluehost'
+ )
);
};
const closeCommentsDaysLabelText = () => {
//`Close comments after ${closeCommentsDays} days.`
return (
- __('Close comments after ', 'wp-plugin-bluehost') +
+ __( 'Close comments after ', 'wp-plugin-bluehost' ) +
closeCommentsDays +
- _n(' day.', ' days.', parseInt(closeCommentsDays), 'wp-plugin-bluehost')
+ _n(
+ ' day.',
+ ' days.',
+ parseInt( closeCommentsDays ),
+ 'wp-plugin-bluehost'
+ )
);
};
- const handleCloseCommentsDaysChange = (value) => {
- bluehostSettingsApiFetch({ closeCommentsDays: value }, setError, (response) => {
- setNumCloseCommentsDays(value);
- });
+ const handleCloseCommentsDaysChange = ( value ) => {
+ bluehostSettingsApiFetch(
+ { closeCommentsDays: value },
+ setError,
+ // eslint-disable-next-line no-unused-vars
+ ( response ) => {
+ setNumCloseCommentsDays( value );
+ }
+ );
};
const notifySuccess = () => {
- notify.push("close-comments-days-notice", {
+ notify.push( 'close-comments-days-notice', {
title: closeCommentsDaysNoticeTitle(),
- description: (
-
- {closeCommentsDaysNoticeText()}
-
- ),
- variant: "success",
+ description: { closeCommentsDaysNoticeText() } ,
+ variant: 'success',
autoDismiss: 5000,
- });
+ } );
};
- useUpdateEffect(() => {
- setStore({
+ useUpdateEffect( () => {
+ setStore( {
...store,
closeCommentsDays,
- });
+ } );
notifySuccess();
- }, [closeCommentsDays]);
+ }, [ closeCommentsDays ] );
return (