bigbuffet-rw/app/soapbox/features/compose/containers/upload_container.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-01-10 14:01:24 -08:00
import { List as ImmutableList } from 'immutable';
import { connect } from 'react-redux';
2020-03-27 13:59:38 -07:00
import { undoUploadCompose, changeUploadCompose } from '../../../actions/compose';
import { submitCompose } from '../../../actions/compose';
import { openModal } from '../../../actions/modals';
import Upload from '../components/upload';
2020-03-27 13:59:38 -07:00
const mapStateToProps = (state, { id }) => ({
media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
descriptionLimit: state.getIn(['instance', 'description_limit']),
2020-03-27 13:59:38 -07:00
});
const mapDispatchToProps = dispatch => ({
onUndo: id => {
dispatch(undoUploadCompose(id));
},
onDescriptionChange: (id, description) => {
dispatch(changeUploadCompose(id, { description }));
},
onOpenFocalPoint: id => {
dispatch(openModal('FOCAL_POINT', { id }));
},
2021-05-17 13:15:46 -07:00
onOpenModal: media => {
dispatch(openModal('MEDIA', { media: ImmutableList.of(media), index: 0, onClose: console.log }));
2021-05-17 13:15:46 -07:00
},
onSubmit(router) {
2020-03-27 13:59:38 -07:00
dispatch(submitCompose(router));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Upload);