2017-04-29 11:50:29 +02:00
|
|
|
import React from 'react'
|
|
|
|
import {
|
|
|
|
connect,
|
|
|
|
} from 'react-redux'
|
|
|
|
import {
|
|
|
|
selectObscureNsfw,
|
|
|
|
selectHidePrice,
|
|
|
|
selectHasSignature,
|
2017-04-29 19:02:25 +02:00
|
|
|
selectPlatform,
|
2017-04-29 11:50:29 +02:00
|
|
|
} from 'selectors/app'
|
2017-04-29 19:02:25 +02:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
|
|
|
makeSelectLoadingForUri,
|
|
|
|
} from 'selectors/file_info'
|
|
|
|
import {
|
|
|
|
makeSelectAvailabilityForUri,
|
|
|
|
} from 'selectors/availability'
|
|
|
|
import {
|
|
|
|
selectCurrentModal,
|
|
|
|
} from 'selectors/app'
|
|
|
|
import {
|
|
|
|
doCloseModal,
|
|
|
|
doOpenModal,
|
|
|
|
} from 'actions/app'
|
|
|
|
import {
|
|
|
|
doOpenFileInShell,
|
|
|
|
doOpenFileInFolder,
|
|
|
|
doDeleteFile,
|
|
|
|
} from 'actions/file_info'
|
|
|
|
import {
|
|
|
|
doWatchVideo,
|
2017-05-01 06:51:19 +02:00
|
|
|
doLoadVideo,
|
2017-04-29 19:02:25 +02:00
|
|
|
} from 'actions/content'
|
2017-04-29 11:50:29 +02:00
|
|
|
import FileActions from './view'
|
|
|
|
|
2017-04-29 19:02:25 +02:00
|
|
|
const makeSelect = () => {
|
|
|
|
const selectFileInfoForUri = makeSelectFileInfoForUri()
|
|
|
|
const selectAvailabilityForUri = makeSelectAvailabilityForUri()
|
|
|
|
const selectDownloadingForUri = makeSelectDownloadingForUri()
|
|
|
|
const selectLoadingForUri = makeSelectLoadingForUri()
|
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
obscureNsfw: selectObscureNsfw(state),
|
|
|
|
hidePrice: selectHidePrice(state),
|
|
|
|
hasSignature: selectHasSignature(state),
|
|
|
|
fileInfo: selectFileInfoForUri(state, props),
|
|
|
|
availability: selectAvailabilityForUri(state, props),
|
|
|
|
platform: selectPlatform(state),
|
|
|
|
modal: selectCurrentModal(state),
|
|
|
|
downloading: selectDownloadingForUri(state, props),
|
|
|
|
loading: selectLoadingForUri(state, props),
|
|
|
|
})
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-04-29 19:02:25 +02:00
|
|
|
return select
|
2017-04-29 11:50:29 +02:00
|
|
|
}
|
|
|
|
|
2017-04-29 19:02:25 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
closeModal: () => dispatch(doCloseModal()),
|
|
|
|
openInFolder: (fileInfo) => dispatch(doOpenFileInFolder(fileInfo)),
|
|
|
|
openInShell: (fileInfo) => dispatch(doOpenFileInShell(fileInfo)),
|
|
|
|
deleteFile: (fileInfo, deleteFromComputer) => dispatch(doDeleteFile(fileInfo, deleteFromComputer)),
|
|
|
|
openModal: (modal) => dispatch(doOpenModal(modal)),
|
|
|
|
downloadClick: () => dispatch(doWatchVideo()),
|
2017-05-01 06:51:19 +02:00
|
|
|
loadVideo: () => dispatch(doLoadVideo())
|
2017-04-29 19:02:25 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
export default connect(makeSelect, perform)(FileActions)
|