339945018d
and refactor history
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import React from "react";
|
|
import { connect } from "react-redux";
|
|
import { doNavigate } from "actions/navigation";
|
|
import { doResolveUri } from "actions/content";
|
|
import { selectShowNsfw } from "selectors/settings";
|
|
import {
|
|
makeSelectClaimForUri,
|
|
makeSelectMetadataForUri,
|
|
} from "selectors/claims";
|
|
import { makeSelectFileInfoForUri } from "selectors/file_info";
|
|
import {
|
|
makeSelectIsResolvingForUri,
|
|
selectRewardContentClaimIds,
|
|
} from "selectors/content";
|
|
import FileCard from "./view";
|
|
|
|
const makeSelect = () => {
|
|
const selectClaimForUri = makeSelectClaimForUri();
|
|
const selectFileInfoForUri = makeSelectFileInfoForUri();
|
|
const selectMetadataForUri = makeSelectMetadataForUri();
|
|
const selectResolvingUri = makeSelectIsResolvingForUri();
|
|
|
|
const select = (state, props) => ({
|
|
claim: selectClaimForUri(state, props),
|
|
fileInfo: selectFileInfoForUri(state, props),
|
|
obscureNsfw: !selectShowNsfw(state),
|
|
metadata: selectMetadataForUri(state, props),
|
|
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
|
isResolvingUri: selectResolvingUri(state, props),
|
|
});
|
|
|
|
return select;
|
|
};
|
|
|
|
const perform = dispatch => ({
|
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
|
});
|
|
|
|
export default connect(makeSelect, perform)(FileCard);
|