2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
2017-08-30 14:48:32 +02:00
|
|
|
import { doNavigate } from "actions/navigation";
|
2017-06-06 23:19:12 +02:00
|
|
|
import { doResolveUri } from "actions/content";
|
2017-04-23 16:01:00 +02:00
|
|
|
import {
|
2017-04-29 11:50:29 +02:00
|
|
|
makeSelectClaimForUri,
|
2017-05-09 00:22:27 +02:00
|
|
|
makeSelectMetadataForUri,
|
2017-06-06 23:19:12 +02:00
|
|
|
} from "selectors/claims";
|
|
|
|
import { makeSelectFileInfoForUri } from "selectors/file_info";
|
2017-06-28 09:12:01 +02:00
|
|
|
import { selectShowNsfw } from "selectors/settings";
|
2017-07-25 09:07:54 +02:00
|
|
|
import {
|
|
|
|
makeSelectIsResolvingForUri,
|
2017-07-30 00:56:08 +02:00
|
|
|
selectRewardContentClaimIds,
|
2017-07-25 09:07:54 +02:00
|
|
|
} from "selectors/content";
|
2017-06-06 23:19:12 +02:00
|
|
|
import FileTile from "./view";
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-04-29 11:50:29 +02:00
|
|
|
const makeSelect = () => {
|
2017-06-06 23:19:12 +02:00
|
|
|
const selectClaimForUri = makeSelectClaimForUri();
|
|
|
|
const selectFileInfoForUri = makeSelectFileInfoForUri();
|
|
|
|
const selectMetadataForUri = makeSelectMetadataForUri();
|
|
|
|
const selectResolvingUri = makeSelectIsResolvingForUri();
|
2017-05-09 00:22:27 +02:00
|
|
|
|
2017-04-29 11:50:29 +02:00
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: selectClaimForUri(state, props),
|
|
|
|
fileInfo: selectFileInfoForUri(state, props),
|
2017-06-28 09:12:01 +02:00
|
|
|
obscureNsfw: !selectShowNsfw(state),
|
2017-05-09 00:22:27 +02:00
|
|
|
metadata: selectMetadataForUri(state, props),
|
|
|
|
isResolvingUri: selectResolvingUri(state, props),
|
2017-07-30 00:56:08 +02:00
|
|
|
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
2017-06-06 23:19:12 +02:00
|
|
|
});
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
return select;
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2017-05-12 01:28:43 +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-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default connect(makeSelect, perform)(FileTile);
|