// @flow import * as ICONS from 'constants/icons'; import React, { useEffect } from 'react'; import { Lbryio } from 'lbryinc'; 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 Yrbl from 'component/yrbl'; import LbcSymbol from 'component/common/lbc-symbol'; import * as PAGES from 'constants/pages'; import HelpLink from 'component/common/help-link'; type Props = { channels: Array, channelUrls: Array, fetchChannelListMine: () => void, fetchingChannels: boolean, youtubeChannels: ?Array, }; export default function ChannelsPage(props: Props) { const { channels, channelUrls, fetchChannelListMine, fetchingChannels, youtubeChannels } = props; const [rewardData, setRewardData] = React.useState(); const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length); const hasPendingChannels = channels && channels.some(channel => channel.confirmations < 0); useEffect(() => { fetchChannelListMine(); }, [fetchChannelListMine, hasPendingChannels]); useEffect(() => { Lbryio.call('user_rewards', 'view_rate').then(data => setRewardData(data)); }, [setRewardData]); return (
{hasYoutubeChannels && } {channelUrls && Boolean(channelUrls.length) && ( {__('Your channels')}} headerAltControls={
); }} renderProperties={claim => { const claimsInChannel = claim.meta.claims_in_channel; if (!claim || claimsInChannel === 0) { return null; } const channelRewardData = rewardData && rewardData.rates && rewardData.rates.find(data => { return data.channel_claim_id === claim.claim_id; }); if (channelRewardData) { return ( {__('Earnings per view')} ); } else { return null; } }} /> )} {!(channelUrls && channelUrls.length) && ( {!fetchingChannels ? (
) : (
)}
)}
); }