2022-01-10 14:01:24 -08:00
|
|
|
import { List as ImmutableList } from 'immutable';
|
2022-01-10 14:17:52 -08:00
|
|
|
import { connect } from 'react-redux';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
import { undoUploadCompose, changeUploadCompose } from '../../../actions/compose';
|
|
|
|
import { submitCompose } from '../../../actions/compose';
|
2022-02-02 05:33:12 -08:00
|
|
|
import { openModal } from '../../../actions/modals';
|
2022-01-10 14:17:52 -08:00
|
|
|
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),
|
2021-07-19 14:14:31 -07:00
|
|
|
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 => {
|
2022-01-30 09:46:57 -08:00
|
|
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(media), index: 0, onClose: console.log }));
|
2021-05-17 13:15:46 -07:00
|
|
|
},
|
|
|
|
|
2020-04-14 14:47:35 -07:00
|
|
|
onSubmit(router) {
|
2020-03-27 13:59:38 -07:00
|
|
|
dispatch(submitCompose(router));
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Upload);
|