2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2018-10-19 16:38:07 -04:00
|
|
|
import { doRemoveUnreadSubscription } from 'redux/actions/subscriptions';
|
2018-07-31 14:07:45 -04:00
|
|
|
import { doSetContentHistoryItem } from 'redux/actions/content';
|
2017-04-28 22:14:44 +07:00
|
|
|
import {
|
2018-04-18 00:03:01 -04:00
|
|
|
doFetchFileInfo,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectFileInfoForUri,
|
2017-05-14 23:50:59 -04:00
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectMetadataForUri,
|
2018-10-19 16:38:07 -04:00
|
|
|
makeSelectChannelForClaimUri,
|
2019-04-03 00:17:00 -04:00
|
|
|
selectBalance,
|
2018-04-18 00:03:01 -04:00
|
|
|
} from 'lbry-redux';
|
2020-01-06 13:32:35 -05:00
|
|
|
import { doFetchViewCount, makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
|
|
|
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
2018-10-19 16:38:07 -04:00
|
|
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
2020-01-06 15:57:49 -05:00
|
|
|
import { makeSelectIsText } from 'redux/selectors/content';
|
2018-04-06 02:00:36 -04:00
|
|
|
import FilePage from './view';
|
2017-04-24 14:25:27 +07:00
|
|
|
|
2017-09-07 23:15:05 -04:00
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
|
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
2019-08-02 02:28:14 -04:00
|
|
|
obscureNsfw: !selectShowMatureContent(state),
|
2017-09-07 23:15:05 -04:00
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
2018-03-26 14:32:43 -07:00
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2018-10-19 16:38:07 -04:00
|
|
|
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
|
|
|
|
channelUri: makeSelectChannelForClaimUri(props.uri, true)(state),
|
2019-04-03 00:17:00 -04:00
|
|
|
balance: selectBalance(state),
|
2020-01-06 15:57:49 -05:00
|
|
|
isText: makeSelectIsText(props.uri)(state),
|
2017-09-07 23:15:05 -04:00
|
|
|
});
|
2017-04-24 14:25:27 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
const perform = dispatch => ({
|
2017-06-06 17:19:12 -04:00
|
|
|
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
|
|
|
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
2018-07-31 14:07:45 -04:00
|
|
|
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
|
2018-10-19 16:38:07 -04:00
|
|
|
markSubscriptionRead: (channel, uri) => dispatch(doRemoveUnreadSubscription(channel, uri)),
|
2019-03-14 14:40:26 -04:00
|
|
|
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
2017-06-05 21:21:55 -07:00
|
|
|
});
|
2017-04-24 14:25:27 +07:00
|
|
|
|
2018-07-31 09:29:28 -04:00
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(FilePage);
|