lbry-desktop/ui/component/downloadProgress/index.js
2021-10-05 09:20:34 -07:00

24 lines
860 B
JavaScript
Executable file

import { connect } from 'react-redux';
import DownloadProgress from './view';
import { doSetPlayingUri, doStopDownload, doUpdateDownloadingStatus } from 'redux/actions/content';
import { selectFileInfosByOutpoint } from 'lbry-redux';
const select = (state) => {
const byOutpoint = selectFileInfosByOutpoint(state);
const runningByOutpoint = [];
for (const key in byOutpoint) {
if (byOutpoint[key] && byOutpoint[key].status === 'running') runningByOutpoint.push(byOutpoint[key]);
}
return {
downloadList: runningByOutpoint,
};
};
const perform = (dispatch) => ({
pause: () => dispatch(doSetPlayingUri({ uri: null })),
updateDownloadingStatus: (outpoint) => dispatch(doUpdateDownloadingStatus(outpoint)),
stopDownload: (outpoint) => dispatch(doStopDownload(outpoint)),
});
export default connect(select, perform)(DownloadProgress);