lbry-desktop/ui/js/page/filePage/index.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

import React from 'react'
import {
connect
} from 'react-redux'
2017-05-21 16:42:34 +02:00
import {
doNavigate,
} from 'actions/app'
2017-05-12 19:14:06 +02:00
import {
2017-05-15 05:50:59 +02:00
doFetchFileInfo,
2017-05-12 19:14:06 +02:00
} from 'actions/file_info'
import {
2017-05-15 05:50:59 +02:00
makeSelectFileInfoForUri,
2017-04-28 17:14:44 +02:00
} from 'selectors/file_info'
import {
doFetchCostInfoForUri,
} from 'actions/cost_info'
2017-04-28 17:14:44 +02:00
import {
2017-05-15 05:50:59 +02:00
makeSelectClaimForUri,
makeSelectContentTypeForUri,
makeSelectMetadataForUri,
2017-04-28 17:14:44 +02:00
} from 'selectors/claims'
import {
2017-05-15 05:50:59 +02:00
makeSelectCostInfoForUri,
2017-04-28 17:14:44 +02:00
} from 'selectors/cost_info'
2017-05-04 05:44:08 +02:00
import FilePage from './view'
2017-05-15 05:50:59 +02:00
const makeSelect = () => {
const selectClaim = makeSelectClaimForUri(),
selectContentType = makeSelectContentTypeForUri(),
selectFileInfo = makeSelectFileInfoForUri(),
selectCostInfo = makeSelectCostInfoForUri(),
selectMetadata = makeSelectMetadataForUri()
const select = (state, props) => ({
claim: selectClaim(state, props),
contentType: selectContentType(state, props),
costInfo: selectCostInfo(state, props),
metadata: selectMetadata(state, props),
fileInfo: selectFileInfo(state, props)
})
return select
}
const perform = (dispatch) => ({
2017-05-21 16:42:34 +02:00
navigate: (path, params) => dispatch(doNavigate(path, params)),
fetchFileInfo: (uri) => dispatch(doFetchFileInfo(uri)),
fetchCostInfo: (uri) => dispatch(doFetchCostInfoForUri(uri)),
})
2017-05-15 05:50:59 +02:00
export default connect(makeSelect, perform)(FilePage)