import React from 'react'; import Column from 'flavours/glitch/components/column'; import ColumnBackButton from 'flavours/glitch/components/column_back_button'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { fetchSuggestions } from 'flavours/glitch/actions/suggestions'; import { markAsPartial } from 'flavours/glitch/actions/timelines'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Account from 'flavours/glitch/containers/account_container'; import EmptyAccount from 'flavours/glitch/components/account'; import { FormattedMessage, FormattedHTMLMessage } from 'react-intl'; import { makeGetAccount } from 'flavours/glitch/selectors'; import { me } from 'flavours/glitch/initial_state'; import ProgressIndicator from './components/progress_indicator'; const mapStateToProps = () => { const getAccount = makeGetAccount(); return state => ({ account: getAccount(state, me), suggestions: state.getIn(['suggestions', 'items']), isLoading: state.getIn(['suggestions', 'isLoading']), }); }; class Follows extends React.PureComponent { static propTypes = { onBack: PropTypes.func, dispatch: PropTypes.func.isRequired, suggestions: ImmutablePropTypes.list, account: ImmutablePropTypes.map, isLoading: PropTypes.bool, }; componentDidMount () { const { dispatch } = this.props; dispatch(fetchSuggestions(true)); } componentWillUnmount () { const { dispatch } = this.props; dispatch(markAsPartial('home')); } render () { const { onBack, isLoading, suggestions, account } = this.props; return (

{isLoading ? (new Array(8)).fill().map((_, i) => ) : suggestions.map(suggestion => ( ))}

{text} }} />

); } } export default connect(mapStateToProps)(Follows);