lbry-desktop/src/ui/component/fileViewer/index.js

31 lines
990 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2019-08-02 08:28:14 +02:00
import { doPlayUri } from 'redux/actions/content';
2017-05-15 05:50:59 +02:00
import {
makeSelectFileInfoForUri,
2019-04-24 16:02:08 +02:00
makeSelectThumbnailForUri,
2019-08-02 08:28:14 +02:00
makeSelectStreamingUrlForUri,
makeSelectMediaTypeForUri,
makeSelectUriIsStreamable,
2018-04-18 06:03:01 +02:00
} from 'lbry-redux';
2019-08-02 08:28:14 +02:00
import { makeSelectIsPlaying, makeSelectShouldObscurePreview } from 'redux/selectors/content';
2018-07-10 05:32:59 +02:00
import FileViewer from './view';
2017-05-15 05:50:59 +02:00
2017-09-08 05:15:05 +02:00
const select = (state, props) => ({
2019-04-24 16:02:08 +02:00
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
2019-08-02 08:28:14 +02:00
mediaType: makeSelectMediaTypeForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
isPlaying: makeSelectIsPlaying(props.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
isStreamable: makeSelectUriIsStreamable(props.uri)(state),
2017-09-08 05:15:05 +02:00
});
2017-04-23 11:56:50 +02:00
2017-06-06 06:21:55 +02:00
const perform = dispatch => ({
2019-08-02 23:03:26 +02:00
play: uri => dispatch(doPlayUri(uri)),
2017-06-06 06:21:55 +02:00
});
2017-04-23 11:56:50 +02:00
2018-07-10 05:32:59 +02:00
export default connect(
select,
perform
)(FileViewer);