change: remove error modal from rewards

This commit is contained in:
Sean Yesmunt 2019-01-17 01:34:31 -05:00
parent ea9658b578
commit afe82c478e
6 changed files with 11 additions and 47 deletions

View file

@ -1,35 +1,19 @@
import { connect } from 'react-redux';
import {
makeSelectClaimRewardError,
makeSelectRewardByType,
makeSelectIsRewardClaimPending,
doClaimRewardType,
doClaimRewardClearError,
} from 'lbryinc';
import { makeSelectRewardByType, makeSelectIsRewardClaimPending, doClaimRewardType } from 'lbryinc';
import { doNavigate } from 'redux/actions/navigation';
import RewardLink from './view';
const makeSelect = () => {
const selectIsPending = makeSelectIsRewardClaimPending();
const selectReward = makeSelectRewardByType();
const selectError = makeSelectClaimRewardError();
const select = (state, props) => ({
errorMessage: selectError(state, props),
isPending: selectIsPending(state, props),
reward: selectReward(state, props.reward_type),
});
return select;
};
const select = (state, props) => ({
isPending: makeSelectIsRewardClaimPending()(state, props),
reward: makeSelectRewardByType()(state, props.reward_type),
});
const perform = dispatch => ({
claimReward: reward => dispatch(doClaimRewardType(reward.reward_type)),
clearError: reward => dispatch(doClaimRewardClearError(reward)),
claimReward: reward => dispatch(doClaimRewardType(reward.reward_type, { notifyError: true })),
navigate: path => dispatch(doNavigate(path)),
});
export default connect(
makeSelect,
select,
perform
)(RewardLink);

View file

@ -1,6 +1,5 @@
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
import Button from 'component/button';
type Reward = {
@ -10,15 +9,13 @@ type Reward = {
type Props = {
isPending: boolean,
label: ?string,
errorMessage: ?string,
reward: Reward,
button: ?boolean,
clearError: Reward => void,
claimReward: Reward => void,
};
const RewardLink = (props: Props) => {
const { reward, claimReward, clearError, errorMessage, label, isPending, button } = props;
const { reward, claimReward, label, isPending, button } = props;
return !reward ? null : (
<div className="reward-link">
@ -30,23 +27,6 @@ const RewardLink = (props: Props) => {
claimReward(reward);
}}
/>
{errorMessage ? (
// TODO: This should be moved to redux
<Modal
isOpen
title={__('Error Claiming Reward')}
contentLabel="Reward Claim Error"
onConfirmed={() => {
clearError(reward);
}}
>
<section className="card__content">
<div className="error-modal__error-list">{errorMessage}</div>
</section>
</Modal>
) : (
''
)}
</div>
);
};

View file

@ -51,7 +51,6 @@ class UserEmailNew extends React.PureComponent<Props, State> {
'In addition, your email address will never be sold and you can unsubscribe at any time.'
)}
</p>
<Form onSubmit={this.handleSubmit}>
<FormRow>
<FormField

View file

@ -22,7 +22,7 @@ class ModalFirstReward extends React.PureComponent<Props> {
<p>{__('You just earned your first reward!')}</p>
<p>
{__(
"This reward will show in your Wallet in the top right momentarily (if it hasn't already)."
"This reward will show in your Wallet in the top left momentarily (if it hasn't already)."
)}
</p>
<p>

View file

@ -152,7 +152,7 @@ class RewardsPage extends PureComponent<Props> {
'card--disabled': isNotEligible,
})}
>
{rewards.map(reward => <RewardTile key={reward.reward_type} reward={reward} />)}
{rewards.map(reward => <RewardTile key={reward.claim_code} reward={reward} />)}
{this.renderCustomRewardCode()}
</div>
);

View file

@ -11,4 +11,5 @@ export type Reward = {
reward_version: ?string,
transaction_id: ?string,
updated_at: ?string,
claim_code: string,
};