import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; import { connect } from 'react-redux'; import { fetchFavourites } from 'soapbox/actions/interactions'; import IconButton from 'soapbox/components/icon_button'; import LoadingIndicator from 'soapbox/components/loading_indicator'; import ScrollableList from 'soapbox/components/scrollable_list'; import AccountContainer from 'soapbox/containers/account_container'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, }); const mapStateToProps = (state, props) => { return { accountIds: state.getIn(['user_lists', 'favourited_by', props.statusId]), }; }; export default @connect(mapStateToProps) @injectIntl class FavouritesModal extends React.PureComponent { static propTypes = { onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, statusId: PropTypes.string.isRequired, username: PropTypes.string.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.orderedSet, }; fetchData = () => { const { dispatch, statusId } = this.props; dispatch(fetchFavourites(statusId)); } componentDidMount() { this.fetchData(); } onClickClose = () => { this.props.onClose('FAVOURITES'); }; render() { const { intl, accountIds } = this.props; let body; if (!accountIds) { body = ; } else { const emptyMessage = ; body = ( {accountIds.map(id => , )} ); } return (

{body}
); } }