// @flow import * as PAGES from 'constants/pages'; import React, { useEffect } from 'react'; import Page from 'component/page'; import TagsSelect from 'component/tagsSelect'; import ClaimList from 'component/claimList'; import Button from 'component/button'; type Props = { subscribedChannels: Array, location: { search: string }, history: { push: string => void }, doFetchRecommendedSubscriptions: () => void, suggestedSubscriptions: Array<{ uri: string }>, }; function FollowingPage(props: Props) { const { subscribedChannels, location, history, doFetchRecommendedSubscriptions, suggestedSubscriptions } = props; const hasSubscriptions = !!subscribedChannels.length; const channelUris = subscribedChannels.map(({ uri }) => uri); const { search } = location; const urlParams = new URLSearchParams(search); const viewingSuggestedSubs = urlParams.get('view') || !hasSubscriptions; function onClick() { let url = `/$/${PAGES.FOLLOWING}`; if (!viewingSuggestedSubs) { url += '?view=discover'; } history.push(url); } useEffect(() => { doFetchRecommendedSubscriptions(); }, [doFetchRecommendedSubscriptions]); return (
onClick()} /> } uris={viewingSuggestedSubs ? suggestedSubscriptions.map(sub => `lbry://${sub.uri}`) : channelUris} />
); } export default FollowingPage;