/** * WordPress dependencies */ import { useSelect } from '@safe-wordpress/data'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { AiIcon } from '@nab/components'; import { store as NAB_DATA } from '@nab/data'; /** * Internal dependencies */ import './style.scss'; import { OpportunityCard } from './opportunity-card'; import { ExperimentSuggestionsModal } from './experiment-suggestions-modal'; export function RecommendationSection(): JSX.Element | null { const { opportunities, isLoading, isAiActive, opportunityBeingInstantiated, } = useSelect( ( select ) => ( { isAiActive: !! select( NAB_DATA ).getPluginSetting( 'aiSettings' ), isLoading: ! select( NAB_DATA ).isRecommendationEngineDataLoaded(), opportunities: select( NAB_DATA ).getOpportunities(), opportunityBeingInstantiated: select( NAB_DATA ).getOpportunityBeingInstantiated(), } ), [] ); // eslint-disable-next-line no-nested-ternary const message = isLoading ? _x( 'Finding opportunities…', 'text', 'nelio-ab-testing' ) : opportunities.length ? _x( 'Recommended opportunities based on your site data and goals.', 'text', 'nelio-ab-testing' ) : _x( 'No recommendations at the moment.', 'text', 'nelio-ab-testing' ); return (

{ _x( 'What should we test next?', 'text', 'nelio-ab-testing' ) }

{ message }

{ !! opportunities.length && (
    { opportunities.map( ( opportunity, index ) => (
  1. ) ) }
) }
); }