import {InfiniteScrollSentinel} from '@common/ui/infinite-scroll/infinite-scroll-sentinel'; import React, {Fragment, ReactNode} from 'react'; import {ChannelContentProps} from '@app/channels/channel-content'; import {useInfiniteChannelContent} from '@common/channels/requests/use-infinite-channel-content'; import {ChannelHeader} from '@app/channels/channel-header/channel-header'; import {ChannelContentModel} from '@app/admin/channels/channel-content-config'; import {ChannelContentListItem} from '@app/channels/channel-content-list-item'; import {useChannelContent} from '@common/channels/requests/use-channel-content'; import clsx from 'clsx'; import { PaginationControls, PaginationControlsType, } from '@common/ui/navigation/pagination-controls'; export function ChannelContentList(props: ChannelContentProps) { const isInfiniteScroll = !props.isNested && (!props.channel.config.paginationType || props.channel.config.paginationType === 'infiniteScroll'); return ( {isInfiniteScroll ? ( ) : ( )} ); } function InfiniteScrollList({channel}: ChannelContentProps) { const query = useInfiniteChannelContent(channel); return ( ); } function PaginatedList({channel, isNested}: ChannelContentProps) { const shouldPaginate = !isNested; const query = useChannelContent(channel, null, {paginate: shouldPaginate}); return (
{shouldPaginate && ( )} {shouldPaginate && ( )}
); } interface ContentProps { content: ChannelContentModel[] | undefined; children?: ReactNode; className?: string; } function Content({content = [], children, className}: ContentProps) { return (
{content.map(item => ( ))} {children}
); }