wire up autoplay

This commit is contained in:
Sean Yesmunt 2018-07-25 00:23:58 -04:00
parent a7c6135afd
commit 01dc3661c8
4 changed files with 17 additions and 5 deletions

View file

@ -9,7 +9,10 @@ type Props = {
uri: string, uri: string,
fetching: boolean, fetching: boolean,
claim: ?{}, claim: ?{},
// below props are just passed to <CreditAmount />
filePage?: boolean, filePage?: boolean,
inheritStyle?: boolean,
showLBC?: boolean,
}; };
class FilePrice extends React.PureComponent<Props> { class FilePrice extends React.PureComponent<Props> {
@ -34,12 +37,14 @@ class FilePrice extends React.PureComponent<Props> {
}; };
render() { render() {
const { costInfo, showFullPrice, filePage } = this.props; const { costInfo, showFullPrice, filePage, inheritStyle, showLBC } = this.props;
return costInfo ? ( return costInfo ? (
<CreditAmount <CreditAmount
showFree showFree
filePage={filePage} filePage={filePage}
inheritStyle={inheritStyle}
showLBC={showLBC}
amount={costInfo.cost} amount={costInfo.cost}
isEstimate={!costInfo.includesData} isEstimate={!costInfo.includesData}
showFullPrice={showFullPrice} showFullPrice={showFullPrice}

View file

@ -1,14 +1,19 @@
import * as settings from 'constants/settings';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doFetchClaimsByChannel } from 'redux/actions/content'; import { doFetchClaimsByChannel } from 'redux/actions/content';
import { makeSelectClaimsInChannelForCurrentPage } from 'lbry-redux'; import { makeSelectClaimsInChannelForCurrentPage } from 'lbry-redux';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import RecommendedVideos from './view'; import RecommendedVideos from './view';
const select = (state, props) => ({ const select = (state, props) => ({
claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.channelUri)(state), claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.channelUri)(state),
autoplay: makeSelectClientSetting(settings.AUTOPLAY)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)), fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
setAutoplay: value => dispatch(doSetClientSetting(settings.AUTOPLAY, value)),
}); });
export default connect( export default connect(

View file

@ -8,6 +8,8 @@ import type { Claim } from 'types/claim';
type Props = { type Props = {
channelUri: ?string, channelUri: ?string,
claimsInChannel: ?Array<Claim>, claimsInChannel: ?Array<Claim>,
autoplay: boolean,
setAutoplay: boolean => void,
fetchClaims: (string, number) => void, fetchClaims: (string, number) => void,
}; };
@ -20,7 +22,7 @@ export default class RecommendedVideos extends React.PureComponent<Props> {
} }
render() { render() {
const { claimsInChannel } = this.props; const { claimsInChannel, autoplay, setAutoplay } = this.props;
return ( return (
<div className="card__list--recommended"> <div className="card__list--recommended">
@ -32,8 +34,8 @@ export default class RecommendedVideos extends React.PureComponent<Props> {
name="autoplay" name="autoplay"
type="checkbox" type="checkbox"
prefix={__('Autoplay')} prefix={__('Autoplay')}
checked={false} checked={autoplay}
onChange={() => {}} onChange={e => setAutoplay(e.target.checked)}
/> />
</ToolTip> </ToolTip>
</FormRow> </FormRow>

View file

@ -31,7 +31,7 @@ class ModalAffirmPurchase extends React.PureComponent {
> >
{__('This will purchase')} <strong>{title}</strong> {__('for')}{' '} {__('This will purchase')} <strong>{title}</strong> {__('for')}{' '}
<strong> <strong>
<FilePrice uri={uri} showFullPrice look="plain" /> <FilePrice uri={uri} showFullPrice inheritStyle showLBC={false} />
</strong>{' '} </strong>{' '}
{__('credits')}. {__('credits')}.
</Modal> </Modal>