From 2d755be6b81de5f20d2733d7b9e8ad48f9726ca8 Mon Sep 17 00:00:00 2001 From: Sanjay Bhangar Date: Fri, 7 Dec 2018 19:43:25 +0200 Subject: [PATCH] add count for current topic in random topic component --- src/actions/topics.js | 2 +- src/components/RandomTopic.js | 5 +++-- src/containers/Home.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/actions/topics.js b/src/actions/topics.js index 32edf52..50e53c2 100644 --- a/src/actions/topics.js +++ b/src/actions/topics.js @@ -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)); }); diff --git a/src/components/RandomTopic.js b/src/components/RandomTopic.js index b9c6bd2..b70439a 100644 --- a/src/components/RandomTopic.js +++ b/src/components/RandomTopic.js @@ -21,7 +21,7 @@ class RandomTopic extends React.Component { See All Topics - See All videos of {this.props.topicName} () + See All videos of {this.props.topicName} ({this.props.topicCount}) @@ -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); \ No newline at end of file diff --git a/src/containers/Home.js b/src/containers/Home.js index fa87710..55d38b9 100644 --- a/src/containers/Home.js +++ b/src/containers/Home.js @@ -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 });