lbry-desktop/ui/modal/modalPublishPreview/index.js

33 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-08-13 21:06:43 +02:00
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import ModalPublishPreview from './view';
import {
makeSelectPublishFormValue,
selectPublishFormValues,
selectIsStillEditing,
selectMyChannelClaims,
SETTINGS,
} from 'lbry-redux';
import { selectFfmpegStatus, makeSelectClientSetting } from 'redux/selectors/settings';
2020-08-13 21:06:43 +02:00
import { doPublishDesktop } from 'redux/actions/publish';
import { doSetClientSetting } from 'redux/actions/settings';
2020-08-13 21:06:43 +02:00
const select = (state) => ({
2020-08-13 21:06:43 +02:00
...selectPublishFormValues(state),
myChannels: selectMyChannelClaims(state),
2020-08-13 21:06:43 +02:00
isVid: makeSelectPublishFormValue('fileVid')(state),
2021-03-30 01:05:18 +02:00
publishSuccess: makeSelectPublishFormValue('publishSuccess')(state),
publishing: makeSelectPublishFormValue('publishing')(state),
isStillEditing: selectIsStillEditing(state),
2020-08-13 21:06:43 +02:00
ffmpegStatus: selectFfmpegStatus(state),
enablePublishPreview: makeSelectClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW)(state),
2020-08-13 21:06:43 +02:00
});
const perform = (dispatch) => ({
2020-08-13 21:06:43 +02:00
publish: (filePath, preview) => dispatch(doPublishDesktop(filePath, preview)),
closeModal: () => dispatch(doHideModal()),
setEnablePublishPreview: (value) => dispatch(doSetClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW, value)),
2020-08-13 21:06:43 +02:00
});
export default connect(select, perform)(ModalPublishPreview);