From 9555c6fa762ddfb7ab58e5aa9771507b6327fc39 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 4 Mar 2019 16:06:51 +0100 Subject: [PATCH] add button to view subscriptions from the suggested subscriptions view --- .../suggestedSubscriptionItem/view.js | 2 +- app/src/page/subscriptions/view.js | 35 +++++++++++++++---- app/src/styles/subscriptions.js | 17 ++++++++- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/app/src/component/suggestedSubscriptionItem/view.js b/app/src/component/suggestedSubscriptionItem/view.js index 86a6187..209751c 100644 --- a/app/src/component/suggestedSubscriptionItem/view.js +++ b/app/src/component/suggestedSubscriptionItem/view.js @@ -43,7 +43,7 @@ class SuggestedSubscriptionItem extends React.PureComponent { return ( diff --git a/app/src/page/subscriptions/view.js b/app/src/page/subscriptions/view.js index 8f2b82f..a52f09f 100644 --- a/app/src/page/subscriptions/view.js +++ b/app/src/page/subscriptions/view.js @@ -13,6 +13,7 @@ import { import { buildURI, parseURI } from 'lbry-redux'; import { uriFromFileInfo } from 'utils/helper'; import moment from 'moment'; +import Button from 'component/button'; import Colors from 'styles/colors'; import Constants from 'constants'; import discoverStyle from 'styles/discover'; @@ -24,6 +25,10 @@ import SuggestedSubscriptions from 'component/suggestedSubscriptions'; import UriBar from 'component/uriBar'; class SubscriptionsPage extends React.PureComponent { + state = { + showingSuggestedSubs: false + }; + componentWillMount() { const { doFetchMySubscriptions, @@ -62,14 +67,19 @@ class SubscriptionsPage extends React.PureComponent { unreadSubscriptions, navigation, } = this.props; + const numberOfSubscriptions = subscribedChannels ? subscribedChannels.length : 0; const hasSubscriptions = numberOfSubscriptions > 0; + if (!hasSubscriptions && !this.state.showingSuggestedSubs) { + this.setState({ showingSuggestedSubs: true }); + } + return ( - {hasSubscriptions && !loading && + {(!this.state.showingSuggestedSubs && hasSubscriptions && !loading) && } - {(hasSubscriptions && !loading) && + {(!this.state.showingSuggestedSubs && hasSubscriptions && !loading) && - {(viewMode === Constants.SUBSCRIPTIONS_VIEW_ALL) && } - {(!hasSubscriptions && !loading) && - + {this.state.showingSuggestedSubs && + + {!hasSubscriptions && You are not subscribed to any channels at the moment. Here are some channels that we think you might enjoy. - + } + + {hasSubscriptions && + + + You are currently subscribed to {numberOfSubscriptions} channel{(numberOfSubscriptions > 1) ? 's' : ''}. + +