diff --git a/packages/js/src/dashboard/components/dashboard.js b/packages/js/src/dashboard/components/dashboard.js index 193ef04d044..d0c4cfbf61c 100644 --- a/packages/js/src/dashboard/components/dashboard.js +++ b/packages/js/src/dashboard/components/dashboard.js @@ -17,7 +17,7 @@ export const Dashboard = ( { contentTypes, userName, features } ) => { return ( <> -
+
{ features.indexables && features.seoAnalysis && } { features.indexables && features.readabilityAnalysis && }
diff --git a/packages/js/src/general/components/connected-premium-upsell-list.js b/packages/js/src/general/components/connected-premium-upsell-list.js new file mode 100644 index 00000000000..cce55eb5bd4 --- /dev/null +++ b/packages/js/src/general/components/connected-premium-upsell-list.js @@ -0,0 +1,24 @@ +import { useSelect } from "@wordpress/data"; +import { PremiumUpsellList } from "../../shared-admin/components"; +import { STORE_NAME } from "../constants"; +import { useSelectGeneralPage } from "../hooks"; + +/** + * @returns {JSX.Element|null} The premium upsell list or null if not applicable. + */ +export const ConnectedPremiumUpsellList = () => { + const isPremium = useSelectGeneralPage( "selectPreference", [], "isPremium" ); + const premiumUpsellConfig = useSelectGeneralPage( "selectUpsellSettingsAsProps" ); + const { isPromotionActive } = useSelect( STORE_NAME ); + const premiumLinkList = useSelectGeneralPage( "selectLink", [], "https://yoa.st/17h" ); + + if ( isPremium ) { + return null; + } + return ; +}; + diff --git a/packages/js/src/general/initialize.js b/packages/js/src/general/initialize.js index 49990a4a174..9bba09cded4 100644 --- a/packages/js/src/general/initialize.js +++ b/packages/js/src/general/initialize.js @@ -9,6 +9,7 @@ import { Dashboard } from "../dashboard"; import { LINK_PARAMS_NAME } from "../shared-admin/store"; import App from "./app"; import { RouteErrorFallback } from "./components"; +import { ConnectedPremiumUpsellList } from "./components/connected-premium-upsell-list"; import { SidebarLayout } from "./components/sidebar-layout"; import { STORE_NAME } from "./constants"; import { AlertCenter, FirstTimeConfiguration, ROUTES } from "./routes"; @@ -49,7 +50,6 @@ domReady( () => { seoAnalysis: get( window, "wpseoScriptData.dashboard.enabledAnalysisFeatures.keyphraseAnalysis", false ), readabilityAnalysis: get( window, "wpseoScriptData.dashboard.enabledAnalysisFeatures.readabilityAnalysis", false ), }; - const router = createHashRouter( createRoutesFromElements( } errorElement={ }> @@ -58,13 +58,14 @@ domReady( () => { element={ + } errorElement={ } /> } + element={ } errorElement={ } /> } errorElement={ } /> diff --git a/packages/js/src/general/routes/alert-center.js b/packages/js/src/general/routes/alert-center.js index 550397d9e47..f1631af5a55 100644 --- a/packages/js/src/general/routes/alert-center.js +++ b/packages/js/src/general/routes/alert-center.js @@ -1,20 +1,11 @@ -import { useSelect } from "@wordpress/data"; import { __ } from "@wordpress/i18n"; import { Paper, Title } from "@yoast/ui-library"; -import { PremiumUpsellList } from "../../shared-admin/components"; import { Notifications, Problems } from "../components"; -import { STORE_NAME } from "../constants"; -import { useSelectGeneralPage } from "../hooks"; /** * @returns {JSX.Element} The general page content placeholder. */ export const AlertCenter = () => { - const isPremium = useSelectGeneralPage( "selectPreference", [], "isPremium" ); - const premiumLinkList = useSelectGeneralPage( "selectLink", [], "https://yoa.st/17h" ); - const premiumUpsellConfig = useSelectGeneralPage( "selectUpsellSettingsAsProps" ); - const { isPromotionActive } = useSelect( STORE_NAME ); - return ( <> @@ -29,13 +20,6 @@ export const AlertCenter = () => {
- { isPremium ? null : ( - - ) } ); }; diff --git a/packages/js/src/shared-admin/components/premium-upsell-list.js b/packages/js/src/shared-admin/components/premium-upsell-list.js index 42f19a9eaa3..ecc231bfa3e 100644 --- a/packages/js/src/shared-admin/components/premium-upsell-list.js +++ b/packages/js/src/shared-admin/components/premium-upsell-list.js @@ -1,8 +1,8 @@ -import { noop } from "lodash"; import { ArrowNarrowRightIcon } from "@heroicons/react/outline"; import { createInterpolateElement } from "@wordpress/element"; import { __, sprintf } from "@wordpress/i18n"; -import { Button, Title, Paper } from "@yoast/ui-library"; +import { Button, Paper, Title } from "@yoast/ui-library"; +import { noop } from "lodash"; import PropTypes from "prop-types"; import { getPremiumBenefits } from "../../helpers/get-premium-benefits";