Show Campaigns card when banner is dismissed or campaigns total is truthy.
This commit is contained in:
parent
11683be1a8
commit
ddd287cc4c
|
@ -12,6 +12,7 @@ import '~/marketing/data-multichannel';
|
||||||
import { CenteredSpinner } from '~/marketing/components';
|
import { CenteredSpinner } from '~/marketing/components';
|
||||||
import {
|
import {
|
||||||
useIntroductionBanner,
|
useIntroductionBanner,
|
||||||
|
useCampaigns,
|
||||||
useRegisteredChannels,
|
useRegisteredChannels,
|
||||||
useRecommendedChannels,
|
useRecommendedChannels,
|
||||||
useCampaignTypes,
|
useCampaignTypes,
|
||||||
|
@ -31,6 +32,7 @@ export const MarketingOverviewMultichannel: React.FC = () => {
|
||||||
isIntroductionBannerDismissed,
|
isIntroductionBannerDismissed,
|
||||||
dismissIntroductionBanner,
|
dismissIntroductionBanner,
|
||||||
} = useIntroductionBanner();
|
} = useIntroductionBanner();
|
||||||
|
const { loading: loadingCampaigns, meta: metaCampaigns } = useCampaigns();
|
||||||
const {
|
const {
|
||||||
loading: loadingCampaignTypes,
|
loading: loadingCampaignTypes,
|
||||||
data: dataCampaignTypes,
|
data: dataCampaignTypes,
|
||||||
|
@ -48,6 +50,7 @@ export const MarketingOverviewMultichannel: React.FC = () => {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
loadingIntroductionBanner ||
|
loadingIntroductionBanner ||
|
||||||
|
( loadingCampaigns && metaCampaigns?.total === undefined ) ||
|
||||||
( loadingCampaignTypes && ! dataCampaignTypes ) ||
|
( loadingCampaignTypes && ! dataCampaignTypes ) ||
|
||||||
( loadingRegistered && ! dataRegistered ) ||
|
( loadingRegistered && ! dataRegistered ) ||
|
||||||
( loadingRecommended && ! dataRecommended )
|
( loadingRecommended && ! dataRecommended )
|
||||||
|
@ -55,6 +58,10 @@ export const MarketingOverviewMultichannel: React.FC = () => {
|
||||||
return <CenteredSpinner />;
|
return <CenteredSpinner />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shouldShowCampaigns =
|
||||||
|
dataRegistered?.length &&
|
||||||
|
( isIntroductionBannerDismissed || !! metaCampaigns?.total );
|
||||||
|
|
||||||
const shouldShowExtensions =
|
const shouldShowExtensions =
|
||||||
getAdminSetting( 'allowMarketplaceSuggestions', false ) &&
|
getAdminSetting( 'allowMarketplaceSuggestions', false ) &&
|
||||||
currentUserCan( 'install_plugins' );
|
currentUserCan( 'install_plugins' );
|
||||||
|
@ -76,7 +83,7 @@ export const MarketingOverviewMultichannel: React.FC = () => {
|
||||||
} }
|
} }
|
||||||
/>
|
/>
|
||||||
) }
|
) }
|
||||||
{ !! dataRegistered?.length && <Campaigns /> }
|
{ !! shouldShowCampaigns && <Campaigns /> }
|
||||||
{ !! ( dataRegistered && dataRecommended ) &&
|
{ !! ( dataRegistered && dataRecommended ) &&
|
||||||
!! ( dataRegistered.length || dataRecommended.length ) && (
|
!! ( dataRegistered.length || dataRecommended.length ) && (
|
||||||
<Channels
|
<Channels
|
||||||
|
|
Loading…
Reference in New Issue