From e1aac3407946b093251968f97b74aee20ead9720 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 17 Feb 2020 14:12:28 -0500 Subject: [PATCH] use claim_search for channel discovery --- static/app-strings.json | 7 +- ui/component/router/view.jsx | 6 +- ui/constants/pages.js | 1 + ui/page/channelsFollowing/index.js | 17 +---- ui/page/channelsFollowing/view.jsx | 72 +++++++------------ .../index.js | 0 ui/page/channelsFollowingDiscover/view.jsx | 57 +++++++++++++++ ui/page/channelsFollowingManage/view.jsx | 56 --------------- ui/page/home/view.jsx | 21 ++++++ ui/scss/component/_claim-list.scss | 2 +- ui/scss/init/_gui.scss | 6 ++ 11 files changed, 124 insertions(+), 121 deletions(-) rename ui/page/{channelsFollowingManage => channelsFollowingDiscover}/index.js (100%) create mode 100644 ui/page/channelsFollowingDiscover/view.jsx delete mode 100644 ui/page/channelsFollowingManage/view.jsx diff --git a/static/app-strings.json b/static/app-strings.json index 890a509f1..9b65203cc 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -957,5 +957,10 @@ "Cover Recommended ratio is 6.25:1": "Cover Recommended ratio is 6.25:1", "You already have a claim with this name.": "You already have a claim with this name.", "You are not currently sharing diagnostic data so this error was not reported.": "You are not currently sharing diagnostic data so this error was not reported.", - "Go to Invites": "Go to Invites" + "Go to Invites": "Go to Invites", + "Find Channels to Follow": "Find Channels to Follow", + "Sign in with lbry.tv to receive notifications about new content.": "Sign in with lbry.tv to receive notifications about new content.", + "Find new channels to follow": "Find new channels to follow", + "You aren't currently following any channels. %discover_channels_link%.": "You aren't currently following any channels. %discover_channels_link%.", + "LBRY Works Better If You Are Following Channels": "LBRY Works Better If You Are Following Channels" } \ No newline at end of file diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index f176b56e3..78e9acd5a 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -21,7 +21,7 @@ import WalletPage from 'page/wallet'; import TagsPage from 'page/tags'; import TagsFollowingPage from 'page/tagsFollowing'; import ChannelsFollowingPage from 'page/channelsFollowing'; -import ChannelsFollowingManagePage from 'page/channelsFollowingManage'; +import ChannelsFollowingDiscoverPage from 'page/channelsFollowingDiscover'; import TagsFollowingManagePage from 'page/tagsFollowingManage'; import ListBlockedPage from 'page/listBlocked'; import FourOhFourPage from 'page/fourOhFour'; @@ -130,6 +130,8 @@ function AppRouter(props: Props) { return ( + + @@ -140,7 +142,7 @@ function AppRouter(props: Props) { exact component={isAuthenticated || !IS_WEB ? ChannelsFollowingPage : DiscoverPage} /> - + diff --git a/ui/constants/pages.js b/ui/constants/pages.js index dd8492c5e..c94fc7e11 100644 --- a/ui/constants/pages.js +++ b/ui/constants/pages.js @@ -24,6 +24,7 @@ exports.TAGS_FOLLOWING = 'following/tags'; exports.TAGS_FOLLOWING_MANAGE = 'following/tags/manage'; exports.CHANNELS_FOLLOWING = 'following/channels'; exports.CHANNELS_FOLLOWING_MANAGE = 'following/channels/manage'; +exports.CHANNELS_FOLLOWING_DISCOVER = 'following/channels/discover'; exports.WALLET = 'wallet'; exports.BLOCKED = 'blocked'; exports.CHANNELS = 'channels'; diff --git a/ui/page/channelsFollowing/index.js b/ui/page/channelsFollowing/index.js index a64f05d27..1d811bee6 100644 --- a/ui/page/channelsFollowing/index.js +++ b/ui/page/channelsFollowing/index.js @@ -1,20 +1,9 @@ import { connect } from 'react-redux'; -import { selectUserVerifiedEmail } from 'lbryinc'; -import { selectSubscriptions, selectSuggestedChannels } from 'redux/selectors/subscriptions'; -import { doFetchRecommendedSubscriptions } from 'redux/actions/subscriptions'; -import DiscoverPage from './view'; +import { selectSubscriptions } from 'redux/selectors/subscriptions'; +import ChannelsFollowingPage from './view'; const select = state => ({ subscribedChannels: selectSubscriptions(state), - email: selectUserVerifiedEmail(state), - suggestedSubscriptions: selectSuggestedChannels(state), }); -const perform = { - doFetchRecommendedSubscriptions, -}; - -export default connect( - select, - perform -)(DiscoverPage); +export default connect(select)(ChannelsFollowingPage); diff --git a/ui/page/channelsFollowing/view.jsx b/ui/page/channelsFollowing/view.jsx index 5c6cc36a7..377301229 100644 --- a/ui/page/channelsFollowing/view.jsx +++ b/ui/page/channelsFollowing/view.jsx @@ -2,8 +2,8 @@ import * as PAGES from 'constants/pages'; import * as ICONS from 'constants/icons'; import React from 'react'; +import ChannelsFollowingDiscoverPage from 'page/channelsFollowingDiscover'; import ClaimListDiscover from 'component/claimListDiscover'; -import ClaimList from 'component/claimList'; import Page from 'component/page'; import Button from 'component/button'; import Icon from 'component/common/icon'; @@ -11,59 +11,37 @@ import Icon from 'component/common/icon'; import { TYPE_NEW } from 'component/claimListDiscover/view'; type Props = { - email: string, subscribedChannels: Array, - doFetchRecommendedSubscriptions: () => void, - suggestedSubscriptions: Array<{ uri: string }>, }; -function ChannelsFollowing(props: Props) { - const { subscribedChannels, suggestedSubscriptions, doFetchRecommendedSubscriptions } = props; +function ChannelsFollowingPage(props: Props) { + const { subscribedChannels } = props; const hasSubsribedChannels = subscribedChannels.length > 0; - const [showTab, setShowTab] = React.useState(!hasSubsribedChannels); - React.useEffect(() => { - if (!hasSubsribedChannels) { - doFetchRecommendedSubscriptions(); - } - }, [doFetchRecommendedSubscriptions, hasSubsribedChannels]); - - return ( + return !hasSubsribedChannels ? ( + + ) : ( - {showTab ? ( - setShowTab(false)} - /> - } - uris={suggestedSubscriptions.map(sub => `lbry://${sub.uri}`)} - /> - ) : ( - - - {__('Following')} - - } - defaultTypeSort={TYPE_NEW} - channelIds={subscribedChannels.map(sub => sub.uri.split('#')[1])} - meta={ -