lbry-desktop/ui/component/fileDownloadLink/index.js
Rafael 5794432288 Refactor fileActions
- moved doPrepareEdit incognito and channel calls to separate action
- same with download
- Tooltips
- No major differences between mobile or default returned components so removed condition since mobile style will be changed later on this branch
2022-02-08 12:35:40 -05:00

35 lines
1.3 KiB
JavaScript

import { connect } from 'react-redux';
import { selectClaimIsMine, selectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
import {
makeSelectFileInfoForUri,
makeSelectDownloadingForUri,
makeSelectLoadingForUri,
makeSelectStreamingUrlForUri,
} from 'redux/selectors/file_info';
import { selectCostInfoForUri } from 'lbryinc';
import { doOpenModal } from 'redux/actions/app';
import { doSetPlayingUri, doDownloadUri } from 'redux/actions/content';
import FileDownloadLink from './view';
const select = (state, props) => {
const claim = selectClaimForUri(state, props.uri);
return {
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
downloading: makeSelectDownloadingForUri(props.uri)(state),
loading: makeSelectLoadingForUri(props.uri)(state),
claimIsMine: selectClaimIsMine(state, claim),
claim,
costInfo: selectCostInfoForUri(state, props.uri),
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
};
};
const perform = (dispatch) => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
pause: () => dispatch(doSetPlayingUri({ uri: null })),
download: (uri) => dispatch(doDownloadUri(uri)),
});
export default connect(select, perform)(FileDownloadLink);