2018-06-11 00:41:25 -06:00
|
|
|
import { connect } from 'react-redux';
|
2021-10-17 16:36:14 +08:00
|
|
|
import { makeSelectDownloadPathForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
2021-11-12 23:59:11 +08:00
|
|
|
import { makeSelectClaimForUri, selectThumbnailForUri, makeSelectContentTypeForUri } from 'redux/selectors/claims';
|
2021-10-17 16:36:14 +08:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2021-11-23 12:29:04 +08:00
|
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
2020-05-21 11:38:28 -04:00
|
|
|
import { makeSelectFileRenderModeForUri, makeSelectFileExtensionForUri } from 'redux/selectors/content';
|
2018-06-11 00:41:25 -06:00
|
|
|
import FileRender from './view';
|
|
|
|
|
2020-01-31 10:46:50 -05:00
|
|
|
const select = (state, props) => {
|
2021-11-23 12:29:04 +08:00
|
|
|
const autoplay = props.embedded ? false : selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA);
|
2020-01-31 10:46:50 -05:00
|
|
|
return {
|
2021-11-23 12:29:04 +08:00
|
|
|
currentTheme: selectClientSetting(state, SETTINGS.THEME),
|
2020-01-31 10:46:50 -05:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2021-11-12 23:59:11 +08:00
|
|
|
thumbnail: selectThumbnailForUri(state, props.uri),
|
2020-01-31 10:46:50 -05:00
|
|
|
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
|
|
|
downloadPath: makeSelectDownloadPathForUri(props.uri)(state),
|
2020-04-01 14:43:50 -04:00
|
|
|
fileExtension: makeSelectFileExtensionForUri(props.uri)(state),
|
2020-05-21 11:38:28 -04:00
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
2020-04-01 14:43:50 -04:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
2020-01-31 10:46:50 -05:00
|
|
|
autoplay: autoplay,
|
|
|
|
};
|
|
|
|
};
|
2018-06-11 00:41:25 -06:00
|
|
|
|
2021-02-17 22:44:37 +08:00
|
|
|
export default connect(select)(FileRender);
|