diff --git a/client/a8c-for-agencies/sections/marketplace/controller.tsx b/client/a8c-for-agencies/sections/marketplace/controller.tsx index 333991a9351321..b324894e8a19ec 100644 --- a/client/a8c-for-agencies/sections/marketplace/controller.tsx +++ b/client/a8c-for-agencies/sections/marketplace/controller.tsx @@ -35,7 +35,13 @@ export const marketplaceProductsContext: Callback = ( context, next ) => { <> { isEnabled( 'a4a-product-page-redesign' ) ? ( - + ) : ( Products Overview V2; +import page from '@automattic/calypso-router'; +import { SiteDetails } from '@automattic/data-stores'; +import { useBreakpoint } from '@automattic/viewport-react'; +import { useTranslate } from 'i18n-calypso'; +import { useEffect, useState } from 'react'; +import A4AAgencyApprovalNotice from 'calypso/a8c-for-agencies/components/a4a-agency-approval-notice'; +import { LayoutWithGuidedTour as Layout } from 'calypso/a8c-for-agencies/components/layout/layout-with-guided-tour'; +import LayoutTop from 'calypso/a8c-for-agencies/components/layout/layout-with-payment-notification'; +import MobileSidebarNavigation from 'calypso/a8c-for-agencies/components/sidebar/mobile-sidebar-navigation'; +import { + A4A_MARKETPLACE_CHECKOUT_LINK, + A4A_MARKETPLACE_LINK, +} from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants'; +import LayoutBody from 'calypso/layout/hosting-dashboard/body'; +import LayoutHeader, { + LayoutHeaderActions as Actions, + LayoutHeaderBreadcrumb as Breadcrumb, +} from 'calypso/layout/hosting-dashboard/header'; +import { useSelector } from 'calypso/state'; +import getSites from 'calypso/state/selectors/get-sites'; +import ReferralToggle from '../common/referral-toggle'; +import { ShoppingCartContext } from '../context'; +import withMarketplaceType from '../hoc/with-marketplace-type'; +import useShoppingCart from '../hooks/use-shopping-cart'; +import ProductListing from '../products-overview/product-listing'; +import ShoppingCart from '../shopping-cart'; + +import './style.scss'; + +type Props = { + siteId?: string; + suggestedProduct?: string; + productBrand: string; + searchQuery?: string; +}; + +export function ProductsOverviewV2( { + siteId, + suggestedProduct, + productBrand, + searchQuery, +}: Props ) { + const [ selectedSite, setSelectedSite ] = useState< SiteDetails | null | undefined >( null ); + + const translate = useTranslate(); + + const isNarrowView = useBreakpoint( '<660px' ); + + const sites = useSelector( getSites ); + + const { + selectedCartItems, + setSelectedCartItems, + onRemoveCartItem, + showCart, + setShowCart, + toggleCart, + } = useShoppingCart(); + + useEffect( () => { + if ( siteId && sites.length > 0 ) { + const site = siteId ? sites.find( ( site ) => site?.ID === parseInt( siteId ) ) : null; + setSelectedSite( site ); + } + }, [ siteId, sites ] ); + + return ( + + + + + + + + + + { + page( A4A_MARKETPLACE_CHECKOUT_LINK ); + } } + /> + + + + + + + { + // we will remove this once we have the new product listing component + + } + + + + ); } + +export default withMarketplaceType( ProductsOverviewV2 ); diff --git a/client/a8c-for-agencies/sections/marketplace/products-overview-v2/style.scss b/client/a8c-for-agencies/sections/marketplace/products-overview-v2/style.scss new file mode 100644 index 00000000000000..a575baae22d702 --- /dev/null +++ b/client/a8c-for-agencies/sections/marketplace/products-overview-v2/style.scss @@ -0,0 +1,41 @@ +$background-color: #05374A; + +.products-overview-v2.main.hosting-dashboard-layout { + .hosting-dashboard-layout__container { + height: auto; + overflow: auto; + display: block; + } + + .hosting-dashboard-layout__top-wrapper { + max-height: auto; + background: url( calypso/assets/images/a8c-for-agencies/marketplace-hosting-page-v3-bg.svg ) no-repeat top right $background-color; + border-block-end: none; + position: sticky; + top: 0; + z-index: 100; + } + + .hosting-dashboard-layout__header-breadcrumb { + color: var(--color-neutral-40); + fill: var(--color-neutral-40); + + a { + color: var(--color-primary-5); + } + } + + .hosting-dashboard-layout__header-actions { + background-color: var(--color-surface); + border-radius: 8px; /* stylelint-disable-line */ + padding: 8px 16px; + + .shopping-cart { + margin: 0; + } + } + + .components-button:is(.is-primary, .is-secondary) { + min-height: 40px; + } +}