闭社主体 forked from https://github.com/tootsuite/mastodon
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.

18 lines
643 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 > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
  6. resetFileKey: state.getIn(['compose', 'resetFileKey']),
  7. });
  8. const mapDispatchToProps = dispatch => ({
  9. onSelectFile (files) {
  10. dispatch(uploadCompose(files));
  11. },
  12. });
  13. export default connect(mapStateToProps, mapDispatchToProps)(UploadButton);