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

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-04-23 11:56:50 +02:00
import React from 'react'
import {
connect,
} from 'react-redux'
import {
doCloseModal,
} from 'actions/app'
import {
selectCurrentModal,
} from 'selectors/app'
import {
doPurchaseUri,
2017-04-23 11:56:50 +02:00
doLoadVideo,
} from 'actions/content'
import {
2017-05-15 05:50:59 +02:00
makeSelectMetadataForUri
} from 'selectors/claims'
import {
makeSelectFileInfoForUri,
makeSelectLoadingForUri,
makeSelectDownloadingForUri,
2017-04-28 17:14:44 +02:00
} from 'selectors/file_info'
import {
2017-05-15 05:50:59 +02:00
makeSelectCostInfoForUri,
2017-04-28 17:14:44 +02:00
} from 'selectors/cost_info'
2017-04-23 11:56:50 +02:00
import Video from './view'
2017-05-15 05:50:59 +02:00
const makeSelect = () => {
const selectCostInfo = makeSelectCostInfoForUri()
const selectFileInfo = makeSelectFileInfoForUri()
const selectIsLoading = makeSelectLoadingForUri()
const selectIsDownloading = makeSelectDownloadingForUri()
const selectMetadata = makeSelectMetadataForUri()
const select = (state, props) => ({
costInfo: selectCostInfo(state, props),
fileInfo: selectFileInfo(state, props),
metadata: selectMetadata(state, props),
modal: selectCurrentModal(state),
isLoading: selectIsLoading(state, props),
isDownloading: selectIsDownloading(state, props),
})
return select
}
2017-04-23 11:56:50 +02:00
const perform = (dispatch) => ({
2017-05-15 05:50:59 +02:00
loadVideo: (uri) => dispatch(doLoadVideo(uri)),
2017-05-25 19:40:46 +02:00
purchaseUri: (uri) => dispatch(doPurchaseUri(uri, 'affirmPurchaseAndPlay')),
2017-04-23 11:56:50 +02:00
closeModal: () => dispatch(doCloseModal()),
})
2017-05-15 05:50:59 +02:00
export default connect(makeSelect, perform)(Video)