2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2018-04-30 17:27:20 +02:00
|
|
|
import * as settings from 'constants/settings';
|
2018-10-19 22:38:07 +02:00
|
|
|
import { doRemoveUnreadSubscription } from 'redux/actions/subscriptions';
|
2018-04-30 17:27:20 +02:00
|
|
|
import { doSetClientSetting } from 'redux/actions/settings';
|
2018-07-31 20:07:45 +02:00
|
|
|
import { doSetContentHistoryItem } from 'redux/actions/content';
|
2017-04-28 17:14:44 +02:00
|
|
|
import {
|
2018-04-18 06:03:01 +02:00
|
|
|
doFetchFileInfo,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectFileInfoForUri,
|
2017-05-15 05:50:59 +02:00
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectContentTypeForUri,
|
|
|
|
makeSelectMetadataForUri,
|
2018-10-19 22:38:07 +02:00
|
|
|
makeSelectChannelForClaimUri,
|
2019-04-03 06:17:00 +02:00
|
|
|
selectBalance,
|
2019-04-24 16:02:08 +02:00
|
|
|
makeSelectTitleForUri,
|
|
|
|
makeSelectThumbnailForUri,
|
|
|
|
makeSelectClaimIsNsfw,
|
2019-07-03 04:30:34 +02:00
|
|
|
doPrepareEdit,
|
2018-04-18 06:03:01 +02:00
|
|
|
} from 'lbry-redux';
|
2019-05-07 23:38:29 +02:00
|
|
|
import { doFetchViewCount, makeSelectViewCountForUri, makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
|
2019-08-02 08:28:14 +02:00
|
|
|
import { selectShowMatureContent, makeSelectClientSetting } from 'redux/selectors/settings';
|
2018-10-19 22:38:07 +02:00
|
|
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
2018-10-29 18:23:53 +01:00
|
|
|
import { doOpenModal } from 'redux/actions/app';
|
2019-08-14 03:24:20 +02:00
|
|
|
import fs from 'fs';
|
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),
|
2019-08-02 08:28:14 +02:00
|
|
|
obscureNsfw: !selectShowMatureContent(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
2018-03-26 23:32:43 +02:00
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2018-10-19 22:38:07 +02:00
|
|
|
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
|
|
|
|
channelUri: makeSelectChannelForClaimUri(props.uri, true)(state),
|
2019-03-14 19:40:26 +01:00
|
|
|
viewCount: makeSelectViewCountForUri(props.uri)(state),
|
2019-04-03 06:17:00 +02:00
|
|
|
balance: selectBalance(state),
|
2019-04-24 16:02:08 +02:00
|
|
|
title: makeSelectTitleForUri(props.uri)(state),
|
|
|
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
|
|
|
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
2019-07-19 22:21:41 +02:00
|
|
|
supportOption: makeSelectClientSetting(settings.SUPPORT_OPTION)(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-06-06 23:19:12 +02:00
|
|
|
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
|
|
|
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
2018-10-29 18:23:53 +01:00
|
|
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
2019-08-14 03:24:20 +02:00
|
|
|
prepareEdit: (publishData, uri, fileInfo) => dispatch(doPrepareEdit(publishData, uri, fileInfo, fs)),
|
2018-04-30 17:27:20 +02:00
|
|
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
2018-07-31 20:07:45 +02:00
|
|
|
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
|
2018-10-19 22:38:07 +02:00
|
|
|
markSubscriptionRead: (channel, uri) => dispatch(doRemoveUnreadSubscription(channel, uri)),
|
2019-03-14 19:40:26 +01:00
|
|
|
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-24 09:25:27 +02:00
|
|
|
|
2018-07-31 15:29:28 +02:00
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(FilePage);
|