2017-06-06 06:21:55 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doNavigate } from 'actions/app';
|
|
|
|
import { doResolveUri, doCancelResolveUri } from 'actions/content';
|
|
|
|
import { selectObscureNsfw } from 'selectors/app';
|
2017-04-23 16:01:00 +02:00
|
|
|
import {
|
2017-06-06 06:21:55 +02:00
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectMetadataForUri
|
|
|
|
} from 'selectors/claims';
|
|
|
|
import { makeSelectFileInfoForUri } from 'selectors/file_info';
|
|
|
|
import { makeSelectIsResolvingForUri } from 'selectors/content';
|
|
|
|
import FileCard from './view';
|
2017-04-23 16:01:00 +02:00
|
|
|
|
2017-04-29 11:50:29 +02:00
|
|
|
const makeSelect = () => {
|
2017-06-06 06:21:55 +02:00
|
|
|
const selectClaimForUri = makeSelectClaimForUri();
|
|
|
|
const selectFileInfoForUri = makeSelectFileInfoForUri();
|
|
|
|
const selectMetadataForUri = makeSelectMetadataForUri();
|
|
|
|
const selectResolvingUri = makeSelectIsResolvingForUri();
|
2017-05-02 06:48:16 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: selectClaimForUri(state, props),
|
|
|
|
fileInfo: selectFileInfoForUri(state, props),
|
|
|
|
obscureNsfw: selectObscureNsfw(state),
|
|
|
|
metadata: selectMetadataForUri(state, props),
|
|
|
|
isResolvingUri: selectResolvingUri(state, props)
|
|
|
|
});
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
return select;
|
|
|
|
};
|
2017-04-24 09:25:27 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
|
|
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
|
|
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
|
|
|
cancelResolveUri: uri => dispatch(doCancelResolveUri(uri))
|
|
|
|
});
|
2017-04-24 09:25:27 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default connect(makeSelect, perform)(FileCard);
|