reply_indicator_container.js 836 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { connect } from 'react-redux';
  2. import { cancelReplyCompose } from '../../../actions/compose';
  3. import { makeGetStatus } from '../../../selectors';
  4. import ReplyIndicator from '../components/reply_indicator';
  5. const makeMapStateToProps = () => {
  6. const getStatus = makeGetStatus();
  7. const mapStateToProps = state => {
  8. let statusId = state.getIn(['compose', 'id'], null);
  9. let editing = true;
  10. if (statusId === null) {
  11. statusId = state.getIn(['compose', 'in_reply_to']);
  12. editing = false;
  13. }
  14. return {
  15. status: getStatus(state, { id: statusId }),
  16. editing,
  17. };
  18. };
  19. return mapStateToProps;
  20. };
  21. const mapDispatchToProps = dispatch => ({
  22. onCancel () {
  23. dispatch(cancelReplyCompose());
  24. },
  25. });
  26. export default connect(makeMapStateToProps, mapDispatchToProps)(ReplyIndicator);