lbry-desktop/src/renderer/page/file/index.js

46 lines
1.9 KiB
JavaScript
Raw Normal View History

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