2020-01-27 19:52:25 +01:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { makeSelectClaimForUri } from 'lbry-redux';
|
2020-04-16 23:43:09 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2020-04-14 01:48:11 +02:00
|
|
|
import { makeSelectIsPlayerFloating, makeSelectNextUnplayedRecommended } from 'redux/selectors/content';
|
2020-01-27 19:52:25 +01:00
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
2020-01-27 20:32:20 +01:00
|
|
|
import { doSetPlayingUri } from 'redux/actions/content';
|
2020-04-14 01:48:11 +02:00
|
|
|
import AutoplayCountdown from './view';
|
2020-01-27 19:52:25 +01:00
|
|
|
|
2020-04-16 23:43:09 +02:00
|
|
|
/*
|
|
|
|
AutoplayCountdown does not fetch it's own next content to play, it relies on <RecommendedContent> being rendered. This is dumb but I'm just the guy who noticed
|
|
|
|
*/
|
2020-01-27 19:52:25 +01:00
|
|
|
const select = (state, props) => {
|
|
|
|
const nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
|
|
|
|
return {
|
|
|
|
nextRecommendedUri,
|
|
|
|
nextRecommendedClaim: makeSelectClaimForUri(nextRecommendedUri)(state),
|
2020-04-14 01:48:11 +02:00
|
|
|
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
2020-01-27 19:52:25 +01:00
|
|
|
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-01-27 20:32:20 +01:00
|
|
|
const perform = dispatch => ({
|
|
|
|
setPlayingUri: uri => dispatch(doSetPlayingUri(uri)),
|
|
|
|
});
|
2020-01-27 19:52:25 +01:00
|
|
|
|
2020-04-16 23:43:09 +02:00
|
|
|
export default withRouter(connect(select, perform)(AutoplayCountdown));
|