import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { fetchFavourites } from 'soapbox/actions/interactions';
import ScrollableList from 'soapbox/components/scrollable_list';
import { Modal, Spinner } from 'soapbox/components/ui';
import AccountContainer from 'soapbox/containers/account_container';
const mapStateToProps = (state, props) => {
return {
accountIds: state.getIn(['user_lists', 'favourited_by', props.statusId]),
};
};
export default @connect(mapStateToProps)
class FavouritesModal extends React.PureComponent {
static propTypes = {
onClose: PropTypes.func.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 { accountIds } = this.props;
let body;
if (!accountIds) {
body = ;
} else {
const emptyMessage = ;
body = (
{accountIds.map(id =>
,
)}
);
}
return (
}
onClose={this.onClickClose}
>
{body}
);
}
}