diff --git a/src/app/Sidebar/RightSidebar.js b/src/app/Sidebar/RightSidebar.js index 344727fca7..0221a10862 100644 --- a/src/app/Sidebar/RightSidebar.js +++ b/src/app/Sidebar/RightSidebar.js @@ -2,7 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Route, Switch } from 'react-router-dom'; -import people from '../../helpers/people'; import { getIsAuthenticated, getAuthenticatedUser, @@ -10,15 +9,13 @@ import { getRecommendations, } from '../../reducers'; import { updateRecommendations } from '../../user/userActions'; -import { - getFollowingList, -} from '../../reducers'; import InterestingPeople from '../../components/Sidebar/InterestingPeople'; import InterestingPeopleWithAPI from '../../components/Sidebar/InterestingPeopleWithAPI'; -import PostRecommendation from '../../components/Sidebar/PostRecommendation'; import StartNow from '../../components/Sidebar/StartNow'; import SignUp from '../../components/Sidebar/SignUp'; +import PostRecommendation from '../../components/Sidebar/PostRecommendation'; +@connect( state => ({ authenticated: getIsAuthenticated(state), authenticatedUser: getAuthenticatedUser(state), @@ -29,18 +26,11 @@ import SignUp from '../../components/Sidebar/SignUp'; updateRecommendations, }, ) -@connect(state => ({ - authenticated: getIsAuthenticated(state), - authenticatedUser: getAuthenticatedUser(state), - authFetching: getIsAuthFetching(state), - followingList: getFollowingList(state), export default class RightSidebar extends React.Component { static propTypes = { authenticated: PropTypes.bool.isRequired, authenticatedUser: PropTypes.shape().isRequired, isAuthFetching: PropTypes.bool.isRequired, - authFetching: PropTypes.bool.isRequired, - followingList: PropTypes.arrayOf(PropTypes.string).isRequired, showPostRecommendation: PropTypes.bool, recommendations: PropTypes.arrayOf(PropTypes.shape({ name: PropTypes.string })).isRequired, updateRecommendations: PropTypes.func, @@ -49,70 +39,41 @@ export default class RightSidebar extends React.Component { static defaultProps = { showPostRecommendation: false, updateRecommendations: () => {}, + }; handleInterestingPeopleRefresh = () => this.props.updateRecommendations(); -======= - constructor(props) { - super(props); - this.state = { - randomPeople: this.getRandomPeople(), - }; - } - - getRandomPeople = () => - people - .reduce((res, item) => { - if (!this.props.followingList.includes(item)) { - res.push({ name: item }); - } - return res; - }, []) - .sort(() => 0.5 - Math.random()) - .slice(0, 5); - - handleRefreshInterestingPeople = () => - this.setState({ - randomPeople: this.getRandomPeople(), - }); render() { - const { authenticated, authenticatedUser, authFetching, showPostRecommendation } = this.props; + const { authenticated, authenticatedUser, showPostRecommendation, isAuthFetching } = this.props; + return (