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

38 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-06-11 08:41:25 +02:00
import { connect } from 'react-redux';
2019-08-02 08:28:14 +02:00
import {
makeSelectClaimForUri,
makeSelectThumbnailForUri,
makeSelectContentTypeForUri,
makeSelectStreamingUrlForUri,
makeSelectMediaTypeForUri,
makeSelectDownloadPathForUri,
makeSelectFileNameForUri,
} from 'lbry-redux';
2020-01-27 19:52:25 +01:00
import * as SETTINGS from 'constants/settings';
2018-06-11 08:41:25 +02:00
import { makeSelectClientSetting } from 'redux/selectors/settings';
2020-01-27 19:52:25 +01:00
import { makeSelectIsText } from 'redux/selectors/content';
2020-01-27 20:32:20 +01:00
import { doSetPlayingUri } from 'redux/actions/content';
2018-06-11 08:41:25 +02:00
import FileRender from './view';
2019-08-02 08:28:14 +02:00
const select = (state, props) => ({
2020-01-27 19:52:25 +01:00
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
2019-08-02 08:28:14 +02:00
claim: makeSelectClaimForUri(props.uri)(state),
mediaType: makeSelectMediaTypeForUri(props.uri)(state),
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
contentType: makeSelectContentTypeForUri(props.uri)(state),
downloadPath: makeSelectDownloadPathForUri(props.uri)(state),
fileName: makeSelectFileNameForUri(props.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
2020-01-27 20:32:20 +01:00
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
2020-01-06 21:57:49 +01:00
isText: makeSelectIsText(props.uri)(state),
2018-06-11 08:41:25 +02:00
});
2020-01-27 20:32:20 +01:00
const perform = dispatch => ({
setPlayingUri: uri => dispatch(doSetPlayingUri(uri)),
});
export default connect(
select,
perform
)(FileRender);