fix: user error after phone verification

This commit is contained in:
Sean Yesmunt 2018-04-16 18:44:57 -04:00
parent 7a54159d01
commit 71d97ad413
3 changed files with 56 additions and 46 deletions

View file

@ -50,7 +50,7 @@ class UserPhoneVerify extends React.PureComponent {
error={phoneErrorMessage} error={phoneErrorMessage}
/> />
{/* render help separately so it always shows */} {/* render help separately so it always shows */}
<div className="form-field__helper"> <div className="meta">
<p> <p>
{__('Email')} <Button button="link" href="mailto:help@lbry.io" label="help@lbry.io" />{' '} {__('Email')} <Button button="link" href="mailto:help@lbry.io" label="help@lbry.io" />{' '}
or join our <Button button="link" href="https://chat.lbry.io" label="chat" />{' '} or join our <Button button="link" href="https://chat.lbry.io" label="chat" />{' '}

View file

@ -1,31 +1,31 @@
/* eslint-disable */ // @flow
import React from 'react'; import * as React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import CardVerify from 'component/cardVerify'; import CardVerify from 'component/cardVerify';
import lbryio from 'lbryio.js'; import lbryio from 'lbryio';
import * as icons from 'constants/icons'; import * as icons from 'constants/icons';
class UserVerify extends React.PureComponent { type Props = {
constructor(props) { errorMessage: ?string,
super(props); isPending: boolean,
navigate: string => void,
verifyUserIdentity: string => void,
verifyPhone: () => void,
};
this.state = { class UserVerify extends React.PureComponent<Props> {
code: '', constructor() {
}; super();
(this: any).onToken = this.onToken.bind(this);
} }
handleCodeChanged(event) { onToken(data: { id: string }) {
this.setState({
code: event.target.value,
});
}
onToken(data) {
this.props.verifyUserIdentity(data.id); this.props.verifyUserIdentity(data.id);
} }
render() { render() {
const { errorMessage, isPending, navigate, verifyPhone, modal } = this.props; const { errorMessage, isPending, navigate, verifyPhone } = this.props;
return ( return (
<React.Fragment> <React.Fragment>
<section className="card card--section"> <section className="card card--section">
@ -39,20 +39,18 @@ class UserVerify extends React.PureComponent {
</div> </div>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<div className="card__title"> <div className="card__title">{__('1) Proof via Credit')}</div>
<h3>{__('1) Proof via Credit')}</h3> <p className="card__content">
</div>
<div className="card__content">
{`${__( {`${__(
'If you have a valid credit or debit card, you can use it to instantly prove your humanity.' 'If you have a valid credit or debit card, you can use it to instantly prove your humanity.'
)} ${__('There is no charge at all for this, now or in the future.')} `} )} ${__('There is no charge at all for this, now or in the future.')} `}
</div> </p>
<div className="card__actions"> <div className="card__actions">
{errorMessage && <p className="form-field__error">{errorMessage}</p>} {errorMessage && <p className="form-field__error">{errorMessage}</p>}
<CardVerify <CardVerify
label={__('Perform Card Verification')} label={__('Perform Card Verification')}
disabled={isPending} disabled={isPending}
token={this.onToken.bind(this)} token={this.onToken}
stripeKey={lbryio.getStripeToken()} stripeKey={lbryio.getStripeToken()}
/> />
</div> </div>
@ -68,14 +66,12 @@ class UserVerify extends React.PureComponent {
</div> </div>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<div className="card__title"> <div className="card__title">{__('2) Proof via Phone')}</div>
<h3>{__('2) Proof via Phone')}</h3> <p className="card__content">
</div>
<div className="card__content">
{`${__( {`${__(
'You will receive an SMS text message confirming that your phone number is correct.' 'You will receive an SMS text message confirming that your phone number is correct.'
)}`} )}`}
</div> </p>
<div className="card__actions"> <div className="card__actions">
<Button <Button
onClick={() => { onClick={() => {
@ -94,9 +90,7 @@ class UserVerify extends React.PureComponent {
</div> </div>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<div className="card__title"> <div className="card__title">{__('3) Proof via Chat')}</div>
<h3>{__('3) Proof via Chat')}</h3>
</div>
<div className="card__content"> <div className="card__content">
<p> <p>
{__( {__(
@ -119,18 +113,18 @@ class UserVerify extends React.PureComponent {
</div> </div>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<div className="card__title"> <div className="card__title">{__('Or, Skip It Entirely')}</div>
<h5>{__('Or, Skip It Entirely')}</h5> <p className="card__content">
</div>
<div className="card__content">
<p className="meta">
{__( {__(
'You can continue without this step, but you will not be eligible to earn rewards.' 'You can continue without this step, but you will not be eligible to earn rewards.'
)} )}
</p> </p>
</div>
<div className="card__actions"> <div className="card__actions">
<Button onClick={() => navigate('/discover')} button="primary" label={__('Skip Rewards')} /> <Button
onClick={() => navigate('/discover')}
button="primary"
label={__('Skip Rewards')}
/>
</div> </div>
</section> </section>
</React.Fragment> </React.Fragment>
@ -139,4 +133,3 @@ class UserVerify extends React.PureComponent {
} }
export default UserVerify; export default UserVerify;
/* eslint-enable */

View file

@ -1,3 +1,4 @@
// @flow
import React from 'react'; import React from 'react';
import BusyIndicator from 'component/common/busy-indicator'; import BusyIndicator from 'component/common/busy-indicator';
import RewardListClaimed from 'component/rewardListClaimed'; import RewardListClaimed from 'component/rewardListClaimed';
@ -6,7 +7,20 @@ import Button from 'component/button';
import Page from 'component/page'; import Page from 'component/page';
import classnames from 'classnames'; import classnames from 'classnames';
class RewardsPage extends React.PureComponent { type Props = {
doAuth: () => void,
navigate: string => void,
fetching: boolean,
rewards: Array<{ reward_type: boolean }>,
user: ?{
is_identity_verified: boolean,
},
daemonSettings: {
share_usage_data: boolean,
},
};
class RewardsPage extends React.PureComponent<Props> {
/* /*
Below is broken for users who have claimed all rewards. Below is broken for users who have claimed all rewards.
@ -74,6 +88,8 @@ class RewardsPage extends React.PureComponent {
</div> </div>
); );
} }
return null;
} }
renderUnclaimedRewards() { renderUnclaimedRewards() {
@ -115,7 +131,8 @@ class RewardsPage extends React.PureComponent {
} }
const isNotEligible = const isNotEligible =
!user.primary_email || !user.has_verified_email || !user.is_identity_verified; !user || !user.primary_email || !user.has_verified_email || !user.is_identity_verified;
return ( return (
<div <div
className={classnames('card__list--rewards', { className={classnames('card__list--rewards', {