import React, {Fragment} from 'react'; import {Channel, CHANNEL_MODEL} from '@common/channels/channel'; import {ChannelContentGrid} from '@app/channels/content-grid/channel-content-grid'; import {ChannelHeader} from '@app/channels/channel-header/channel-header'; import { ChannelContentModel, Layout, } from '@app/admin/channels/channel-content-config'; import {ChannelContentCarousel} from '@app/channels/carousel/channel-content-carousel'; import {ChannelContentSlider} from '@app/channels/channel-content-slider'; import {ChannelContentNews} from '@app/channels/channel-content-news'; import {ChannelContentList} from '@app/channels/channel-content-list'; import {Title} from '@app/titles/models/title'; import {NewsArticle} from '@app/titles/models/news-article'; import {useChannelLayouts} from '@app/channels/channel-header/use-channel-layouts'; import {IllustratedMessage} from '@common/ui/images/illustrated-message'; import {Trans} from '@common/i18n/trans'; import {SvgImage} from '@common/ui/images/svg-image/svg-image'; import todoImage from '@app/admin/lists/todo.svg'; export interface ChannelContentProps< T extends ChannelContentModel = ChannelContentModel > { channel: Channel; isNested: boolean; } export function ChannelContent(props: ChannelContentProps) { // only show no results message in non nested channels if (props.isNested && !props.channel.content?.data.length) { return null; } if (props.channel.config.contentModel === CHANNEL_MODEL) { return )} />; } else { return ( ); } } interface NestedChannelsProps { channel: ChannelContentProps['channel']; } function NoResultsMessage({channel}: NestedChannelsProps) { if (channel.content?.data.length === 0) { return ( } title={ channel.type === 'list' ? ( ) : ( ) } /> ); } return null; } export function ChannelLayout(props: ChannelContentProps) { const {channel, isNested} = props; const {selectedLayout} = useChannelLayouts(channel); const layout = ( isNested ? channel.config.nestedLayout : selectedLayout ) as Layout; switch (layout) { case 'grid': return ; case 'landscapeGrid': return ; case 'list': return ; case 'carousel': return ; case 'landscapeCarousel': return ; case 'slider': return ( )} /> ); case 'news': return ( )} /> ); default: return null; } } function NestedChannels({channel, isNested}: ChannelContentProps) { return ( {channel.content?.data.map(nestedChannel => (
} isNested />
))}
); }