2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-09-17 19:11:19 +02:00
|
|
|
import {
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectClaimForUri,
|
|
|
|
doPrepareEdit,
|
|
|
|
selectMyChannelClaims,
|
|
|
|
} from 'lbry-redux';
|
2019-03-12 20:53:55 +01:00
|
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
2020-09-17 19:11:19 +02:00
|
|
|
import { doSetPlayingUri } from 'redux/actions/content';
|
|
|
|
import { doToast } from 'redux/actions/notifications';
|
2021-02-15 17:58:04 +01:00
|
|
|
import { doOpenModal, doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
2020-01-06 19:32:35 +01:00
|
|
|
import fs from 'fs';
|
2020-04-01 20:43:50 +02:00
|
|
|
import FileActions from './view';
|
|
|
|
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
const select = (state, props) => ({
|
2020-01-06 19:32:35 +01:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
2020-09-17 19:11:19 +02:00
|
|
|
myChannels: selectMyChannelClaims(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2021-02-15 17:58:04 +01:00
|
|
|
const perform = (dispatch) => ({
|
2018-10-29 18:23:53 +01:00
|
|
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
2021-02-15 17:58:04 +01:00
|
|
|
prepareEdit: (publishData, uri, fileInfo) => {
|
|
|
|
if (publishData.signing_channel) {
|
|
|
|
dispatch(doSetActiveChannel(publishData.signing_channel.claim_id));
|
|
|
|
} else {
|
|
|
|
dispatch(doSetIncognito(true));
|
|
|
|
}
|
|
|
|
|
|
|
|
dispatch(doPrepareEdit(publishData, uri, fileInfo, fs));
|
|
|
|
},
|
2020-12-21 16:31:34 +01:00
|
|
|
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
2021-02-15 17:58:04 +01:00
|
|
|
doToast: (options) => dispatch(doToast(options)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-29 19:02:25 +02:00
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
export default connect(select, perform)(FileActions);
|