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

51 lines
1.3 KiB
JavaScript
Raw Normal View History

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