add count for current topic in random topic component

This commit is contained in:
Sanjay Bhangar 2018-12-07 19:43:25 +02:00
parent 69c2181afa
commit 2d755be6b8
3 changed files with 5 additions and 4 deletions

View File

@ -40,7 +40,7 @@ export function getRandomTopicVideos(allTopics, numVideos=4) {
return dispatch => {
const randomTopic = getRandomTopic(allTopics);
dispatch(loadingRandomTopicVideos());
fetchVideosByTopic(randomTopic, 0, 4)
fetchVideosByTopic(randomTopic.name, 0, 4)
.then(videos => {
dispatch(loadedRandomTopicVideos(randomTopic, videos));
});

View File

@ -21,7 +21,7 @@ class RandomTopic extends React.Component {
See All Topics
</Link>
<Link to="/topics">
See All videos of {this.props.topicName} ()
See All videos of {this.props.topicName} ({this.props.topicCount})
</Link>
</Grid>
</section>
@ -33,7 +33,8 @@ class RandomTopic extends React.Component {
RandomTopic.propTypes = {
topicName: PropTypes.string,
videos: PropTypes.array,
loading: PropTypes.bool
loading: PropTypes.bool,
topicCount: PropTypes.number
};
export default (RandomTopic);

View File

@ -45,7 +45,7 @@ const mapStateToProps = state => ({
allTopics: state.topics.allTopics,
loadingAllTopics: state.topics.loadingAllTopics,
randomTopic: state.topics.randomTopic,
randomTopicCount: static.topics.randomTopicCount,
randomTopicCount: state.topics.randomTopicCount,
loadingRandomTopic: state.topics.loadingRandomTopic,
randomTopicVideos: state.topics.randomTopicVideos
});