// @flow 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 * as PAGES from 'constants/pages'; import * as ICONS from 'constants/icons'; type Props = { channels: Array, fetchChannelListMine: () => void, fetchingChannels: boolean, youtubeChannels: ?Array, }; export default function ChannelsPage(props: Props) { const { channels, fetchChannelListMine, fetchingChannels, youtubeChannels } = props; const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length); const hasPendingChannels = channels && channels.some(channel => channel.confirmations === -1); useEffect(() => { fetchChannelListMine(); let interval; if (hasPendingChannels) { interval = setInterval(() => { fetchChannelListMine(); }, 5000); } return () => { clearInterval(interval); }; }, [fetchChannelListMine, hasPendingChannels]); return ( {hasYoutubeChannels && } {channels && Boolean(channels.length) && (
channel.permanent_url)} headerAltControls={
)} {!(channels && channels.length) && ( {!fetchingChannels ? (

{__('No Channels Created Yet')}

) : (

{__('Checking for channels')}

)}
)}
); }