// @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 MODALS from 'constants/modal_types'; 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) && ( channel.permanent_url)} headerAltControls={