2020-03-27 13:59:38 -07:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import Upload from '../components/upload';
|
|
|
|
import { undoUploadCompose, changeUploadCompose } from '../../../actions/compose';
|
|
|
|
import { openModal } from '../../../actions/modal';
|
|
|
|
import { submitCompose } from '../../../actions/compose';
|
2021-05-17 13:15:46 -07:00
|
|
|
import { List as ImmutableList } from 'immutable';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { id }) => ({
|
|
|
|
media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
|
|
|
|
});
|
|
|
|
|
|
|
|
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 }));
|
|
|
|
},
|
|
|
|
|
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);
|