// @flow import * as MODALS from 'constants/modal_types'; import * as ICONS from 'constants/icons'; import React, { useEffect } from 'react'; import ClaimList from 'component/claimList'; import Page from 'component/page'; import Button from 'component/button'; import YoutubeTransferStatus from 'component/youtubeTransferStatus'; import Spinner from 'component/spinner'; import Card from 'component/common/card'; type Props = { channels: Array, fetchChannelListMine: () => void, fetchingChannels: boolean, youtubeChannels: ?Array, openModal: string => void, }; export default function ChannelsPage(props: Props) { const { channels, fetchChannelListMine, fetchingChannels, youtubeChannels, openModal } = props; const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length); const hasPendingChannels = channels && channels.some(channel => channel.confirmations < 0); useEffect(() => { fetchChannelListMine(); let interval; if (hasPendingChannels) { interval = setInterval(() => { fetchChannelListMine(); }, 5000); } return () => { clearInterval(interval); }; }, [fetchChannelListMine, hasPendingChannels]); return ( {hasYoutubeChannels && } {channels && Boolean(channels.length) && ( openModal(MODALS.CREATE_CHANNEL)} /> } isBodyList body={ channel.permanent_url)} /> } /> )} {!(channels && channels.length) && ( {!fetchingChannels ? (

{__('No Channels Created Yet')}

) : (

{__('Checking for channels')}

)}
)}
); }