From 7fd0e66d9b223294be7a587f4b503f745e4e27b0 Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Mon, 24 Sep 2018 09:25:32 -0400 Subject: [PATCH] refactor nav links display; move logic to index.js --- client/src/containers/NavigationLinks/index.jsx | 10 ++++++---- client/src/containers/NavigationLinks/view.jsx | 7 +++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/src/containers/NavigationLinks/index.jsx b/client/src/containers/NavigationLinks/index.jsx index 7ef8ff85..d5a9c454 100644 --- a/client/src/containers/NavigationLinks/index.jsx +++ b/client/src/containers/NavigationLinks/index.jsx @@ -1,13 +1,15 @@ import { connect } from 'react-redux'; import { logOutChannel, checkForLoggedInChannel } from '../../actions/channel'; +import isApprovedChannel from '../../../../utils/isApprovedChannel'; import View from './view'; const mapStateToProps = ({ site, channel: { loggedInChannel: { name, shortId, longId } } }) => { return { - site, - channelName : name, - channelShortId: shortId, - channelLongId : longId, + showPublish : (!site.publishOnlyApproved || isApprovedChannel({ longId }, site.approvedChannels)), + closedRegistration: site.closedRegistration, + channelName : name, + channelShortId : shortId, + channelLongId : longId, }; }; diff --git a/client/src/containers/NavigationLinks/view.jsx b/client/src/containers/NavigationLinks/view.jsx index c1a71335..01775688 100644 --- a/client/src/containers/NavigationLinks/view.jsx +++ b/client/src/containers/NavigationLinks/view.jsx @@ -1,7 +1,6 @@ import React from 'react'; import { NavLink, withRouter } from 'react-router-dom'; import NavBarChannelOptionsDropdown from '@components/NavBarChannelOptionsDropdown'; -import isApprovedChannel from '../../../../utils/isApprovedChannel'; const VIEW = 'VIEW'; const LOGOUT = 'LOGOUT'; @@ -29,10 +28,10 @@ class NavigationLinks extends React.Component { } } render () { - const { site, channelLongId, channelName } = this.props; + const { channelName, showPublish, closedRegistration } = this.props; return (
- {(!site.publishOnlyApproved || isApprovedChannel({ longId: channelLongId }, site.approvedChannels)) && - ) : !site.closedRegistration && ( + ) : !closedRegistration && (