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

38 lines
1.6 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { doNavigate } from 'redux/actions/navigation';
import { doFetchFileInfo } from 'redux/actions/file_info';
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
import { selectRewardContentClaimIds } from 'redux/selectors/content';
import { doFetchCostInfoForUri } from 'redux/actions/cost_info';
import { checkSubscriptionLatest } from 'redux/actions/subscriptions';
2017-04-28 17:14:44 +02:00
import {
2017-05-15 05:50:59 +02:00
makeSelectClaimForUri,
makeSelectContentTypeForUri,
makeSelectMetadataForUri,
} from 'redux/selectors/claims';
import { makeSelectCostInfoForUri } from 'redux/selectors/cost_info';
import { selectShowNsfw } from 'redux/selectors/settings';
import FilePage from './view';
import { makeSelectCurrentParam } from 'redux/selectors/navigation';
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),
tab: makeSelectCurrentParam('tab')(state),
2017-09-08 05:15:05 +02:00
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
});
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-06 09:36:04 +01:00
checkSubscriptionLatest: (subscription, uri) =>
dispatch(checkSubscriptionLatest(subscription, uri)),
2017-06-06 06:21:55 +02:00
});
2017-09-08 05:15:05 +02:00
export default connect(select, perform)(FilePage);