You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
774 B

  1. import { connect } from 'react-redux';
  2. import UploadButton from '../components/upload_button';
  3. import { uploadCompose } from '../../../actions/compose';
  4. const mapStateToProps = state => ({
  5. disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) > 3 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
  6. unavailable: state.getIn(['compose', 'poll']) !== null,
  7. resetFileKey: state.getIn(['compose', 'resetFileKey']),
  8. });
  9. const mapDispatchToProps = dispatch => ({
  10. onSelectFile (files) {
  11. dispatch(uploadCompose(files));
  12. },
  13. });
  14. export default connect(mapStateToProps, mapDispatchToProps)(UploadButton);