2022-09-10 14:52:06 -07:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import { uploadCompose } from 'soapbox/actions/compose';
|
|
|
|
|
2022-11-15 09:23:36 -08:00
|
|
|
import UploadButton from '../components/upload-button';
|
2022-09-10 14:52:06 -07:00
|
|
|
|
|
|
|
import type { IntlShape } from 'react-intl';
|
|
|
|
import type { AppDispatch, RootState } from 'soapbox/store';
|
|
|
|
|
|
|
|
const mapStateToProps = (state: RootState, { composeId }: { composeId: string }) => ({
|
2022-09-14 11:01:00 -07:00
|
|
|
disabled: state.compose.get(composeId)?.is_uploading,
|
2022-09-14 13:05:40 -07:00
|
|
|
resetFileKey: state.compose.get(composeId)?.resetFileKey!,
|
2022-09-10 14:52:06 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch: AppDispatch, { composeId }: { composeId: string }) => ({
|
|
|
|
|
|
|
|
onSelectFile(files: FileList, intl: IntlShape) {
|
|
|
|
dispatch(uploadCompose(composeId, files, intl));
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(UploadButton);
|