import { debounce } from 'lodash'; import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import ColumnHeader from 'flavours/glitch/components/column_header'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; import Column from 'flavours/glitch/features/ui/components/column'; import { Helmet } from 'react-helmet'; import Hashtag from 'flavours/glitch/components/hashtag'; import { expandFollowedHashtags, fetchFollowedHashtags } from 'flavours/glitch/actions/tags'; const messages = defineMessages({ heading: { id: 'followed_tags', defaultMessage: 'Followed hashtags' }, }); const mapStateToProps = state => ({ hashtags: state.getIn(['followed_tags', 'items']), isLoading: state.getIn(['followed_tags', 'isLoading'], true), hasMore: !!state.getIn(['followed_tags', 'next']), }); export default @connect(mapStateToProps) @injectIntl class FollowedTags extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, hashtags: ImmutablePropTypes.list, isLoading: PropTypes.bool, hasMore: PropTypes.bool, multiColumn: PropTypes.bool, }; componentDidMount() { this.props.dispatch(fetchFollowedHashtags()); }; handleLoadMore = debounce(() => { this.props.dispatch(expandFollowedHashtags()); }, 300, { leading: true }); render () { const { intl, hashtags, isLoading, hasMore, multiColumn } = this.props; const emptyMessage = ; return ( {hashtags.map((hashtag) => ( day.get('uses')).toArray()} /> ))} ); } }