fix initial reward showing

This commit is contained in:
Jeremy Kauffman 2017-06-28 14:00:10 -04:00
parent 289bb0b4ae
commit bab2f7d53c
3 changed files with 16 additions and 6 deletions

View file

@ -1,5 +1,6 @@
import React from "react";
import * as modal from "constants/modal_types";
import rewards from "rewards.js";
import { connect } from "react-redux";
import { doUserEmailDecline } from "actions/user";
import { doOpenModal } from "actions/app";
@ -8,13 +9,21 @@ import {
selectUserHasEmail,
selectUserIsAuthRequested,
} from "selectors/user";
import { makeSelectHasClaimedReward } from "selectors/rewards";
import AuthOverlay from "./view";
const select = state => ({
hasEmail: selectUserHasEmail(state),
isPending: selectAuthenticationIsPending(state),
isShowing: selectUserIsAuthRequested(state),
});
const select = (state, props) => {
const selectHasClaimed = makeSelectHasClaimedReward();
return {
hasEmail: selectUserHasEmail(state),
isPending: selectAuthenticationIsPending(state),
isShowing: selectUserIsAuthRequested(state),
hasNewUserReward: selectHasClaimed(state, {
reward_type: rewards.TYPE_NEW_USER,
}),
};
};
const perform = dispatch => ({
userEmailDecline: () => dispatch(doUserEmailDecline()),

View file

@ -18,6 +18,7 @@ export class AuthOverlay extends React.PureComponent {
if (
this.props.isShowing &&
!this.props.isPending &&
!nextProps.hasNewUserReward &&
!nextProps.isShowing /* && !getLocal("welcome_screen_shown")*/
) {
setLocal("welcome_screen_shown", true);

View file

@ -383,7 +383,7 @@ class PublishPage extends React.PureComponent {
});
this._updateChannelList(newChannelName);
}, 5000);
}, 10000);
},
error => {
// TODO: better error handling