/** * External dependencies */ import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Card, CardHeader, CardBody, CardDivider } from '@wordpress/components'; /** * Internal dependencies */ import { CardHeaderTitle, CardHeaderDescription, CenteredSpinner, SmartPluginCardBody, } from '~/marketing/components'; import { useChannels } from './useChannels'; import './Channels.scss'; import { InstalledChannelCardBody } from './InstalledChannelCardBody'; export const Channels = () => { const { loading, data: { registeredChannels, recommendedChannels }, } = useChannels(); /** * TODO: we may need to filter the channels against * `@woocommerce/data` installed plugins. */ if ( loading ) { return ( { __( 'Channels', 'woocommerce' ) } ); } /* * If users have no registered channels, * we display recommended channels without collapsible list. */ if ( registeredChannels.length === 0 && recommendedChannels.length > 0 ) { return ( { __( 'Channels', 'woocommerce' ) } { __( 'Start by adding a channel to your store', 'woocommerce' ) } { recommendedChannels.map( ( el, idx ) => { return ( { idx < recommendedChannels.length - 1 && ( ) } ); } ) } ); } /* * TODO: Users have registered channels, * display the registered channels. * If there are recommended channels, * display them in a collapsible list. */ return ( { __( 'Channels', 'woocommerce' ) } { /* TODO: registered channels here. */ } { registeredChannels.map( ( el, idx ) => { return ( { idx < registeredChannels.length - 1 && ( ) } ); } ) } { /* TODO: recommended channels here. */ } { recommendedChannels.length > 0 && ( <> recommended ) } ); };