lbry-desktop/ui/js/page/file/index.js

36 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-06-06 17:19:12 -04:00
import React from "react";
import { connect } from "react-redux";
import { doNavigate } from "actions/navigation";
2017-06-06 17:19:12 -04:00
import { doFetchFileInfo } from "actions/file_info";
import { makeSelectFileInfoForUri } from "selectors/file_info";
2017-07-29 18:56:08 -04:00
import { selectRewardContentClaimIds } from "selectors/content";
2017-06-06 17:19:12 -04:00
import { doFetchCostInfoForUri } from "actions/cost_info";
2017-04-28 22:14:44 +07:00
import {
2017-05-14 23:50:59 -04:00
makeSelectClaimForUri,
makeSelectContentTypeForUri,
makeSelectMetadataForUri,
2017-06-06 17:19:12 -04:00
} from "selectors/claims";
import { makeSelectCostInfoForUri } from "selectors/cost_info";
2017-06-28 14:12:01 +07:00
import { selectShowNsfw } from "selectors/settings";
2017-06-06 17:19:12 -04:00
import FilePage from "./view";
2017-09-20 13:12:53 -04:00
import { makeSelectCurrentParam } from "selectors/navigation";
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),
2017-09-17 14:26:55 -04:00
tab: makeSelectCurrentParam("tab")(state),
2017-09-07 23:15:05 -04:00
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
});
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)),
2017-06-05 21:21:55 -07:00
});
2017-09-07 23:15:05 -04:00
export default connect(select, perform)(FilePage);