2017-04-23 11:56:50 +02:00
|
|
|
import React from 'react'
|
|
|
|
import {
|
|
|
|
connect
|
|
|
|
} from 'react-redux'
|
2017-04-25 07:47:21 +02:00
|
|
|
import {
|
|
|
|
doNavigate,
|
|
|
|
} from 'actions/app'
|
2017-04-29 11:50:29 +02:00
|
|
|
import {
|
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectSourceForUri,
|
|
|
|
makeSelectMetadataForUri,
|
|
|
|
} from 'selectors/claims'
|
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
} from 'selectors/file_info'
|
|
|
|
import {
|
|
|
|
makeSelectFetchingAvailabilityForUri,
|
|
|
|
makeSelectAvailabilityForUri,
|
|
|
|
} from 'selectors/availability'
|
|
|
|
import {
|
|
|
|
selectObscureNsfw,
|
|
|
|
} from 'selectors/app'
|
2017-04-23 11:56:50 +02:00
|
|
|
import FileTileStream from './view'
|
|
|
|
|
2017-04-29 11:50:29 +02:00
|
|
|
const makeSelect = () => {
|
|
|
|
const selectClaimForUri = makeSelectClaimForUri()
|
|
|
|
const selectFileInfoForUri = makeSelectFileInfoForUri()
|
|
|
|
const selectFetchingAvailabilityForUri = makeSelectFetchingAvailabilityForUri()
|
|
|
|
const selectAvailabilityForUri = makeSelectAvailabilityForUri()
|
|
|
|
const selectMetadataForUri = makeSelectMetadataForUri()
|
|
|
|
const selectSourceForUri = makeSelectSourceForUri()
|
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
claim: selectClaimForUri(state, props),
|
|
|
|
fileInfo: selectFileInfoForUri(state, props),
|
|
|
|
fetchingAvailability: selectFetchingAvailabilityForUri(state, props),
|
|
|
|
selectAvailabilityForUri: selectAvailabilityForUri(state, props),
|
2017-04-30 05:19:59 +02:00
|
|
|
obscureNsfw: selectObscureNsfw(state),
|
2017-04-29 11:50:29 +02:00
|
|
|
metadata: selectMetadataForUri(state, props),
|
|
|
|
source: selectSourceForUri(state, props),
|
|
|
|
})
|
|
|
|
|
|
|
|
return select
|
|
|
|
}
|
2017-04-23 11:56:50 +02:00
|
|
|
|
|
|
|
const perform = (dispatch) => ({
|
2017-04-25 07:47:21 +02:00
|
|
|
navigate: (path) => dispatch(doNavigate(path))
|
2017-04-23 11:56:50 +02:00
|
|
|
})
|
|
|
|
|
2017-04-29 11:50:29 +02:00
|
|
|
export default connect(makeSelect, perform)(FileTileStream)
|