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

View file

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

View file

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