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

36 lines
1.7 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 } from 'redux/selectors/publish';
import { selectMyChannelClaims, selectIsStreamPlaceholderForUri } from 'redux/selectors/claims';
import * as SETTINGS from 'constants/settings';
import { selectFfmpegStatus, selectClientSetting, selectLanguage } 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, props) => {
const editingUri = makeSelectPublishFormValue('editingURI')(state);
return {
...selectPublishFormValues(state),
myChannels: selectMyChannelClaims(state),
isVid: makeSelectPublishFormValue('fileVid')(state),
publishSuccess: makeSelectPublishFormValue('publishSuccess')(state),
publishing: makeSelectPublishFormValue('publishing')(state),
remoteFile: makeSelectPublishFormValue('remoteFileUrl')(state),
isStillEditing: selectIsStillEditing(state),
ffmpegStatus: selectFfmpegStatus(state),
enablePublishPreview: selectClientSetting(state, SETTINGS.ENABLE_PUBLISH_PREVIEW),
isLivestreamClaim: selectIsStreamPlaceholderForUri(state, editingUri),
appLanguage: selectLanguage(state), // note: publishForm above has 'language'
};
};
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);