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