import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import IconButton from 'soapbox/components/icon_button'; import { statusToMentionsAccountIdsArray } from 'soapbox/reducers/compose'; import { makeGetStatus } from 'soapbox/selectors'; import Account from '../../reply_mentions/account'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, }); const makeMapStateToProps = () => { const getStatus = makeGetStatus(); return state => { const status = getStatus(state, { id: state.getIn(['compose', 'in_reply_to']) }); if (!status) { return { isReply: false, }; } const me = state.get('me'); const account = state.getIn(['accounts', me]); const mentions = statusToMentionsAccountIdsArray(state, status, account); return { mentions, author: status.getIn(['account', 'id']), // to: state.getIn(['compose', 'to']), isReply: true, }; }; }; class ReplyMentionsModal extends ImmutablePureComponent { static propTypes = { mentions: ImmutablePropTypes.OrderedSet, author: PropTypes.string, intl: PropTypes.object.isRequired, onClose: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired, }; onClickClose = () => { const { onClose } = this.props; onClose('REPLY_MENTIONS'); }; render() { const { intl, mentions, author } = this.props; return (