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

48 lines
1.2 KiB
JavaScript
Raw Normal View History

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