lbry-desktop/ui/js/component/fileCard/index.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import { connect } from "react-redux";
2017-11-13 22:02:23 +01:00
import { doNavigate } from "redux/actions/navigation";
import { doResolveUri } from "redux/actions/content";
import { selectShowNsfw } from "redux/selectors/settings";
import {
makeSelectClaimForUri,
makeSelectMetadataForUri,
2017-11-13 22:02:23 +01:00
} from "redux/selectors/claims";
import { makeSelectFileInfoForUri } from "redux/selectors/file_info";
import {
2017-09-08 05:15:05 +02:00
makeSelectIsUriResolving,
2017-07-30 00:56:08 +02:00
selectRewardContentClaimIds,
2017-11-13 22:02:23 +01:00
} from "redux/selectors/content";
2017-06-06 23:19:12 +02:00
import FileCard from "./view";
2017-04-23 16:01:00 +02:00
2017-09-08 05:15:05 +02:00
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
obscureNsfw: !selectShowNsfw(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
});
2017-06-06 06:21:55 +02:00
const perform = dispatch => ({
2017-05-06 18:31:47 +02:00
navigate: (path, params) => dispatch(doNavigate(path, params)),
2017-06-06 23:19:12 +02:00
resolveUri: uri => dispatch(doResolveUri(uri)),
2017-06-06 06:21:55 +02:00
});
2017-09-08 05:15:05 +02:00
export default connect(select, perform)(FileCard);