2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doNavigate } from 'redux/actions/navigation';
|
2018-03-26 23:32:43 +02:00
|
|
|
import { selectRewardContentClaimIds, selectPlayingUri } from 'redux/selectors/content';
|
2018-03-15 09:34:22 +01:00
|
|
|
import { doCheckSubscription } from 'redux/actions/subscriptions';
|
2017-04-28 17:14:44 +02:00
|
|
|
import {
|
2018-04-18 06:03:01 +02:00
|
|
|
doFetchFileInfo,
|
|
|
|
doFetchCostInfoForUri,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectCostInfoForUri,
|
|
|
|
makeSelectFileInfoForUri,
|
2017-05-15 05:50:59 +02:00
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectContentTypeForUri,
|
|
|
|
makeSelectMetadataForUri,
|
2018-04-19 18:51:18 +02:00
|
|
|
doNotify,
|
2018-04-18 06:03:01 +02:00
|
|
|
} from 'lbry-redux';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
2018-04-18 06:03:01 +02:00
|
|
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
2018-03-26 23:32:43 +02:00
|
|
|
import { selectMediaPaused } from 'redux/selectors/media';
|
|
|
|
import { doPrepareEdit } from 'redux/actions/publish';
|
2018-04-06 08:00:36 +02:00
|
|
|
import FilePage from './view';
|
2017-04-24 09:25:27 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
|
|
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
|
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
|
|
|
obscureNsfw: !selectShowNsfw(state),
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
|
|
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
2018-03-07 21:02:53 +01:00
|
|
|
subscriptions: selectSubscriptions(state),
|
2018-03-26 23:32:43 +02:00
|
|
|
playingUri: selectPlayingUri(state),
|
|
|
|
isPaused: selectMediaPaused(state),
|
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
2017-04-24 09:25:27 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2017-05-21 16:42:34 +02:00
|
|
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
2017-06-06 23:19:12 +02:00
|
|
|
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
|
|
|
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
2018-03-15 09:35:47 +01:00
|
|
|
checkSubscription: subscription => dispatch(doCheckSubscription(subscription)),
|
2018-04-19 18:51:18 +02:00
|
|
|
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
2018-04-06 08:00:36 +02:00
|
|
|
prepareEdit: (publishData, uri) => dispatch(doPrepareEdit(publishData, uri)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-24 09:25:27 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
export default connect(select, perform)(FilePage);
|