From ddd287cc4cfb5c2a8de186c7d6b16f86860da292 Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Sun, 19 Mar 2023 23:30:21 +0800 Subject: [PATCH] Show Campaigns card when banner is dismissed or campaigns total is truthy. --- .../MarketingOverviewMultichannel.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx b/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx index 4b5eb7f21ec..efdd1cbd46c 100644 --- a/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx +++ b/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx @@ -12,6 +12,7 @@ import '~/marketing/data-multichannel'; import { CenteredSpinner } from '~/marketing/components'; import { useIntroductionBanner, + useCampaigns, useRegisteredChannels, useRecommendedChannels, useCampaignTypes, @@ -31,6 +32,7 @@ export const MarketingOverviewMultichannel: React.FC = () => { isIntroductionBannerDismissed, dismissIntroductionBanner, } = useIntroductionBanner(); + const { loading: loadingCampaigns, meta: metaCampaigns } = useCampaigns(); const { loading: loadingCampaignTypes, data: dataCampaignTypes, @@ -48,6 +50,7 @@ export const MarketingOverviewMultichannel: React.FC = () => { if ( loadingIntroductionBanner || + ( loadingCampaigns && metaCampaigns?.total === undefined ) || ( loadingCampaignTypes && ! dataCampaignTypes ) || ( loadingRegistered && ! dataRegistered ) || ( loadingRecommended && ! dataRecommended ) @@ -55,6 +58,10 @@ export const MarketingOverviewMultichannel: React.FC = () => { return ; } + const shouldShowCampaigns = + dataRegistered?.length && + ( isIntroductionBannerDismissed || !! metaCampaigns?.total ); + const shouldShowExtensions = getAdminSetting( 'allowMarketplaceSuggestions', false ) && currentUserCan( 'install_plugins' ); @@ -76,7 +83,7 @@ export const MarketingOverviewMultichannel: React.FC = () => { } } /> ) } - { !! dataRegistered?.length && } + { !! shouldShowCampaigns && } { !! ( dataRegistered && dataRecommended ) && !! ( dataRegistered.length || dataRecommended.length ) && (