diff --git a/composer.json b/composer.json index 4773939a0..e4dcb4a15 100644 --- a/composer.json +++ b/composer.json @@ -73,6 +73,7 @@ "newfold-labs/wp-module-deactivation": "^1.1.1", "newfold-labs/wp-module-ecommerce": "^1.3.27", "newfold-labs/wp-module-global-ctb": "^1.0.11", + "newfold-labs/wp-module-facebook": "^1.0.3", "newfold-labs/wp-module-help-center": "^1.0.24", "newfold-labs/wp-module-loader": "^1.0.10", "newfold-labs/wp-module-marketplace": "^2.2.4", diff --git a/inc/Admin.php b/inc/Admin.php index 264e80231..a5673d0a8 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -66,6 +66,9 @@ public static function subpages() { $home = array( 'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ), ); + $pagesAndPosts = array( + 'bluehost#/pages&posts' => __( 'Pages & Posts', 'wp-plugin-bluehost' ), + ); $store = array( 'bluehost#/store' => __( 'Store', 'wp-plugin-bluehost' ), ); @@ -89,6 +92,7 @@ public static function subpages() { if ( 'atomic' === getContext( 'platform' ) ) { return array_merge( $home, + $pagesAndPosts, $store, $marketplace, $settings, @@ -98,6 +102,7 @@ public static function subpages() { return array_merge( $home, + $pagesAndPosts, $store, $marketplace, $performance, diff --git a/src/app/data/routes.js b/src/app/data/routes.js index 7e413ed46..95f6aaeb7 100644 --- a/src/app/data/routes.js +++ b/src/app/data/routes.js @@ -5,6 +5,7 @@ import { BoltIcon, AdjustmentsHorizontalIcon, BuildingStorefrontIcon, + DocumentDuplicateIcon, } from '@heroicons/react/24/outline'; import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime'; import { Route, Routes } from 'react-router-dom'; @@ -18,6 +19,7 @@ import Staging from '../pages/staging'; import Help from '../pages/help'; import { getMarketplaceSubnavRoutes } from '@modules/wp-module-marketplace/components/marketplaceSubnav'; import { ReactComponent as HelpIcon } from '../components/icons/HelpIcon.svg'; +import PagesAndPosts from '../pages/pagesAndPosts'; const addPartialMatch = ( prefix, path ) => prefix === path ? `${ prefix }/*` : path; @@ -64,6 +66,7 @@ export const AppRoutes = () => { const topRoutePaths = [ '/home', + '/pages&posts', '/store', '/marketplace', '/performance', @@ -80,6 +83,13 @@ export const routes = [ Icon: HomeIcon, condition: true, }, + { + name: '/pages&posts', + title: __( 'Pages & Posts', 'wp-plugin-bluehost' ), + Component: PagesAndPosts, + Icon: DocumentDuplicateIcon, + condition: true, + }, { name: '/store', title: __( 'Store', 'wp-plugin-bluehost' ), diff --git a/src/app/pages/pagesAndPosts/ProductsPages.js b/src/app/pages/pagesAndPosts/ProductsPages.js new file mode 100644 index 000000000..d04eea7fa --- /dev/null +++ b/src/app/pages/pagesAndPosts/ProductsPages.js @@ -0,0 +1,49 @@ +import { Button, Card, Title } from '@newfold/ui-component-library'; + +const ProductsPages = () => { + return ( + + + + + + + + { __( 'Products', 'wp-plugin-bluehost' ) } + +

+ { __( + 'Showcase physical and digital goods, product variations, and custom configurations.', + 'wp-plugin-bluehost' + ) } +

+
+
+ + { __( 'View all', 'wp-plugin-bluehost' ) } + + + + +
+
+ ); +}; + +export default ProductsPages; diff --git a/src/app/pages/pagesAndPosts/blogPosts.js b/src/app/pages/pagesAndPosts/blogPosts.js new file mode 100644 index 000000000..cd5ef59c7 --- /dev/null +++ b/src/app/pages/pagesAndPosts/blogPosts.js @@ -0,0 +1,49 @@ +import { Button, Card, Title } from '@newfold/ui-component-library'; + +const BlogPosts = () => { + return ( + + + + + + + + { __( 'Blog Posts', 'wp-plugin-bluehost' ) } + +

+ { __( + 'Add a new blog post or edit your existing posts.', + 'wp-plugin-bluehost' + ) } +

+
+
+ + { __( 'View all', 'wp-plugin-bluehost' ) } + + + + +
+
+ ); +}; + +export default BlogPosts; diff --git a/src/app/pages/pagesAndPosts/bookingAndAppointments.js b/src/app/pages/pagesAndPosts/bookingAndAppointments.js new file mode 100644 index 000000000..cfac5d7b4 --- /dev/null +++ b/src/app/pages/pagesAndPosts/bookingAndAppointments.js @@ -0,0 +1,49 @@ +import { Button, Card, Title } from '@newfold/ui-component-library'; + +const BookingAndAppointments = () => { + return ( + + + + + + + + { __( 'Bookings & Appointments', 'wp-plugin-bluehost' ) } + +

+ { __( + 'Add your list of services, setup a booking calendar, and edit your bookings form.', + 'wp-plugin-bluehost' + ) } +

+
+
+ + { __( 'View all', 'wp-plugin-bluehost' ) } + + + + +
+
+ ); +}; + +export default BookingAndAppointments; diff --git a/src/app/pages/pagesAndPosts/index.js b/src/app/pages/pagesAndPosts/index.js new file mode 100644 index 000000000..e32466da2 --- /dev/null +++ b/src/app/pages/pagesAndPosts/index.js @@ -0,0 +1,89 @@ +import { Alert, Container, Page } from '@newfold/ui-component-library'; +import { useContext } from '@wordpress/element'; + +import SitePages from './sitePages'; +import BlogPosts from './blogPosts'; +import BookingAndAppointments from './bookingAndAppointments'; +import ProductsPages from './ProductsPages'; +import AppStore from '../../data/store'; + +const PagesAndPosts = () => { + const { store } = useContext( AppStore ); + return ( + + + + + { __( + 'Your site is not live.', + 'wp-plugin-bluehost' + ) } + + + ) : ( + + + { __( + 'Your site is live.', + 'wp-plugin-bluehost' + ) } + + + ) + } + className={ 'wppbh-app-settings-header' } + > + { store?.comingSoon ? ( +

+ { __( + 'Visitors to your site will see your "Coming Soon" page and not your actual site. Visit', + 'wp-plugin-bluehost' + ) }{ ' ' } + + { __( '"Settings"', 'wp-plugin-bluehost' ) } + { ' ' } + { __( + 'to set your site live.', + 'wp-plugin-bluehost' + ) } +

+ ) : ( +

+ { __( + 'Visitors to your site will see all your publicly published pages.', + 'wp-plugin-bluehost' + ) } +

+ ) } +
+ +
+ + + { window.NewfoldRuntime.isYithBookingActive && + window.NewfoldRuntime.isWoocommerceActive && ( + + ) } + { window.NewfoldRuntime.isWoocommerceActive && ( + + ) } +
+
+
+ ); +}; + +export default PagesAndPosts; diff --git a/src/app/pages/pagesAndPosts/sitePages.js b/src/app/pages/pagesAndPosts/sitePages.js new file mode 100644 index 000000000..2141af4dc --- /dev/null +++ b/src/app/pages/pagesAndPosts/sitePages.js @@ -0,0 +1,51 @@ +import { Button, Card, Title } from '@newfold/ui-component-library'; + +const SitePages = () => { + return ( + + + + + + + + { __( 'Site Pages', 'wp-plugin-bluehost' ) } + +

+ { __( + 'Edit your homepage and other existing pages or add new pages to your site.', + 'wp-plugin-bluehost' + ) } +

+
+
+ + { __( 'View all', 'wp-plugin-bluehost' ) } + + + + +
+
+ ); +}; + +export default SitePages; diff --git a/tests/cypress/integration/pagesAndPosts.cy.js b/tests/cypress/integration/pagesAndPosts.cy.js new file mode 100644 index 000000000..31b81cff9 --- /dev/null +++ b/tests/cypress/integration/pagesAndPosts.cy.js @@ -0,0 +1,113 @@ +describe( 'Pages & Posts', function () { + let NewfoldRuntime; + + before( () => { + cy.visit( + '/wp-admin/admin.php?page=' + + Cypress.env( 'pluginId' ) + + '#/pages&posts' + ); + cy.window() + .its( 'NewfoldRuntime' ) + .then( ( data ) => { + NewfoldRuntime = data; + } ); + cy.injectAxe(); + } ); + + it( 'Pages & Posts Exists', () => { + cy.get( '.wppbh-app-pagesAndPosts-page' ) + .contains( 'Pages & Posts' ) + .scrollIntoView() + .should( 'be.visible' ); + } ); + + it( 'site pages Exists', () => { + cy.get( '.wppbh-app-site-page' ) + .findByText( 'Site Pages' ) + .should( 'exist' ); + cy.get( '.wppbh-app-site-page' ) + .find( 'a[href="edit.php?post_type=page"]' ) + .click(); + cy.url().should( 'include', 'edit.php?post_type=page' ); + cy.go( 'back' ); + + cy.get( '.wppbh-app-site-page' ) + .find( 'a[href="post-new.php?post_type=page"] Button' ) + .click(); + cy.url().should( 'include', 'post-new.php?post_type=page' ); + cy.go( 'back' ); + } ); + + it( 'Blog posts Exists', () => { + cy.get( '.wppbh-app-blog-posts' ) + .findByText( 'Blog Posts' ) + .should( 'exist' ); + cy.get( '.wppbh-app-blog-posts' ).find( 'a[href="edit.php"]' ).click(); + cy.url().should( 'include', 'edit.php' ); + cy.go( 'back' ); + + cy.get( '.wppbh-app-blog-posts' ) + .get( 'a[href="post-new.php"] Button' ) + .click(); + cy.url().should( 'include', 'post-new.php' ); + cy.go( 'back' ); + } ); + + it( 'Bookings & Appointments Exists', () => { + if ( + NewfoldRuntime.isYithBookingActive && + NewfoldRuntime.isWoocommerceActive + ) { + cy.get( '.wppbh-app-bookings' ) + .findByText( 'Bookings & Appointments' ) + .should( 'exist' ); + cy.get( '.wppbh-app-bookings' ) + .find( + 'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"]' + ) + .first() + .click(); + cy.url().should( + 'include', + 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' + ); + cy.go( 'back' ); + + cy.get( '.wppbh-app-bookings' ) + .find( + 'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"] Button' + ) + .last() + .click(); + cy.url().should( + 'include', + 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' + ); + cy.go( 'back' ); + } else { + cy.findByText( 'Bookings & Appointments' ).should( 'not.exist' ); + } + } ); + + it( 'Products Exists', () => { + if ( NewfoldRuntime.isWoocommerceActive ) { + cy.get( '.wppbh-app-products' ) + .findByText( 'Products' ) + .should( 'exist' ); + cy.get( '.wppbh-app-products' ) + .find( 'a[href="edit.php?post_type=product"]' ) + .click(); + cy.url().should( 'include', 'edit.php?post_type=product' ); + cy.go( 'back' ); + + cy.get( '.wppbh-app-products' ) + .find( 'a[href="post-new.php?post_type=product"] Button' ) + .click(); + cy.url().should( 'include', 'post-new.php?post_type=product' ); + cy.go( 'back' ); + } else { + cy.findByText( 'Products' ).should( 'not.exist' ); + } + } ); +} );