From 9b9ac580eee035fb9a22325a9b996b9753b780fd Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 8 Dec 2017 16:07:12 -0500 Subject: [PATCH] simplify logic inside of subscription react component --- src/renderer/page/subscriptions/view.jsx | 16 ++-------------- src/renderer/redux/selectors/navigation.js | 2 +- src/renderer/redux/selectors/subscriptions.js | 5 +++++ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/renderer/page/subscriptions/view.jsx b/src/renderer/page/subscriptions/view.jsx index f63b1c260..94f17cd4f 100644 --- a/src/renderer/page/subscriptions/view.jsx +++ b/src/renderer/page/subscriptions/view.jsx @@ -56,14 +56,7 @@ export default class extends React.PureComponent { render() { const { subscriptions, savedSubscriptions } = this.props; - let someClaimsNotLoaded; - for (var i = 0; i < subscriptions.length; i++) { - const subscription = subscriptions[i]; - if (!subscription.claims.length) { - someClaimsNotLoaded = true; - break; - } - } + const someClaimsNotLoaded = Boolean(subscriptions.find(subscription => !subscription.claims.length)) const fetchingSubscriptions = !!savedSubscriptions.length && @@ -92,17 +85,12 @@ export default class extends React.PureComponent { return ""; } - // creating uris for each subscription file - const names = subscription.claims.slice().map(claim => { - return `${claim.name}#${claim.claim_id}`; - }); - return ( ); })} diff --git a/src/renderer/redux/selectors/navigation.js b/src/renderer/redux/selectors/navigation.js index 9189bc9cd..2b1b384c9 100644 --- a/src/renderer/redux/selectors/navigation.js +++ b/src/renderer/redux/selectors/navigation.js @@ -64,7 +64,7 @@ export const selectHeaderLinks = createSelector(selectCurrentPage, page => { case "discover": case "subscriptions": return { - discover: __("Home"), + discover: __("Discover"), subscriptions: __("Subscriptions"), }; default: diff --git a/src/renderer/redux/selectors/subscriptions.js b/src/renderer/redux/selectors/subscriptions.js index 494bd9b0d..5694c8f47 100644 --- a/src/renderer/redux/selectors/subscriptions.js +++ b/src/renderer/redux/selectors/subscriptions.js @@ -39,6 +39,11 @@ export const selectSubscriptionsFromClaims = createSelector( }); } + // all we really need is a uri for each claim + channelClaims = channelClaims.map(claim => { + return `${claim.name}#${claim.claim_id}`; + }) + fetchedSubscriptions.push({ claims: channelClaims, channelName: subscription.channelName,