add topic count in random topic component #7
|
@ -40,7 +40,7 @@ export function getRandomTopicVideos(allTopics, numVideos=4) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
const randomTopic = getRandomTopic(allTopics);
|
const randomTopic = getRandomTopic(allTopics);
|
||||||
dispatch(loadingRandomTopicVideos());
|
dispatch(loadingRandomTopicVideos());
|
||||||
fetchVideosByTopic(randomTopic, 0, 4)
|
fetchVideosByTopic(randomTopic.name, 0, 4)
|
||||||
.then(videos => {
|
.then(videos => {
|
||||||
dispatch(loadedRandomTopicVideos(randomTopic, videos));
|
dispatch(loadedRandomTopicVideos(randomTopic, videos));
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RandomTopic extends React.Component {
|
||||||
See All Topics
|
See All Topics
|
||||||
</Link>
|
</Link>
|
||||||
<Link to="/topics">
|
<Link to="/topics">
|
||||||
See All videos of {this.props.topicName} ()
|
See All videos of {this.props.topicName} ({this.props.topicCount})
|
||||||
</Link>
|
</Link>
|
||||||
</Grid>
|
</Grid>
|
||||||
</section>
|
</section>
|
||||||
|
@ -33,7 +33,8 @@ class RandomTopic extends React.Component {
|
||||||
RandomTopic.propTypes = {
|
RandomTopic.propTypes = {
|
||||||
topicName: PropTypes.string,
|
topicName: PropTypes.string,
|
||||||
videos: PropTypes.array,
|
videos: PropTypes.array,
|
||||||
loading: PropTypes.bool
|
loading: PropTypes.bool,
|
||||||
|
topicCount: PropTypes.number
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (RandomTopic);
|
export default (RandomTopic);
|
|
@ -45,7 +45,7 @@ const mapStateToProps = state => ({
|
||||||
allTopics: state.topics.allTopics,
|
allTopics: state.topics.allTopics,
|
||||||
loadingAllTopics: state.topics.loadingAllTopics,
|
loadingAllTopics: state.topics.loadingAllTopics,
|
||||||
randomTopic: state.topics.randomTopic,
|
randomTopic: state.topics.randomTopic,
|
||||||
randomTopicCount: static.topics.randomTopicCount,
|
randomTopicCount: state.topics.randomTopicCount,
|
||||||
loadingRandomTopic: state.topics.loadingRandomTopic,
|
loadingRandomTopic: state.topics.loadingRandomTopic,
|
||||||
randomTopicVideos: state.topics.randomTopicVideos
|
randomTopicVideos: state.topics.randomTopicVideos
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user