wire up autoplay
This commit is contained in:
parent
a7c6135afd
commit
01dc3661c8
4 changed files with 17 additions and 5 deletions
|
@ -9,7 +9,10 @@ type Props = {
|
|||
uri: string,
|
||||
fetching: boolean,
|
||||
claim: ?{},
|
||||
// below props are just passed to <CreditAmount />
|
||||
filePage?: boolean,
|
||||
inheritStyle?: boolean,
|
||||
showLBC?: boolean,
|
||||
};
|
||||
|
||||
class FilePrice extends React.PureComponent<Props> {
|
||||
|
@ -34,12 +37,14 @@ class FilePrice extends React.PureComponent<Props> {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { costInfo, showFullPrice, filePage } = this.props;
|
||||
const { costInfo, showFullPrice, filePage, inheritStyle, showLBC } = this.props;
|
||||
|
||||
return costInfo ? (
|
||||
<CreditAmount
|
||||
showFree
|
||||
filePage={filePage}
|
||||
inheritStyle={inheritStyle}
|
||||
showLBC={showLBC}
|
||||
amount={costInfo.cost}
|
||||
isEstimate={!costInfo.includesData}
|
||||
showFullPrice={showFullPrice}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
import * as settings from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchClaimsByChannel } from 'redux/actions/content';
|
||||
import { makeSelectClaimsInChannelForCurrentPage } from 'lbry-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import RecommendedVideos from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.channelUri)(state),
|
||||
autoplay: makeSelectClientSetting(settings.AUTOPLAY)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
||||
setAutoplay: value => dispatch(doSetClientSetting(settings.AUTOPLAY, value)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
|
|
@ -8,6 +8,8 @@ import type { Claim } from 'types/claim';
|
|||
type Props = {
|
||||
channelUri: ?string,
|
||||
claimsInChannel: ?Array<Claim>,
|
||||
autoplay: boolean,
|
||||
setAutoplay: boolean => void,
|
||||
fetchClaims: (string, number) => void,
|
||||
};
|
||||
|
||||
|
@ -20,7 +22,7 @@ export default class RecommendedVideos extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { claimsInChannel } = this.props;
|
||||
const { claimsInChannel, autoplay, setAutoplay } = this.props;
|
||||
|
||||
return (
|
||||
<div className="card__list--recommended">
|
||||
|
@ -32,8 +34,8 @@ export default class RecommendedVideos extends React.PureComponent<Props> {
|
|||
name="autoplay"
|
||||
type="checkbox"
|
||||
prefix={__('Autoplay')}
|
||||
checked={false}
|
||||
onChange={() => {}}
|
||||
checked={autoplay}
|
||||
onChange={e => setAutoplay(e.target.checked)}
|
||||
/>
|
||||
</ToolTip>
|
||||
</FormRow>
|
||||
|
|
|
@ -31,7 +31,7 @@ class ModalAffirmPurchase extends React.PureComponent {
|
|||
>
|
||||
{__('This will purchase')} <strong>{title}</strong> {__('for')}{' '}
|
||||
<strong>
|
||||
<FilePrice uri={uri} showFullPrice look="plain" />
|
||||
<FilePrice uri={uri} showFullPrice inheritStyle showLBC={false} />
|
||||
</strong>{' '}
|
||||
{__('credits')}.
|
||||
</Modal>
|
||||
|
|
Loading…
Reference in a new issue