lbry-desktop/ui/js/component/authOverlay/index.jsx

34 lines
1 KiB
React
Raw Normal View History

2017-06-08 02:56:52 +02:00
import React from "react";
import * as modal from "constants/modal_types";
2017-06-28 20:00:10 +02:00
import rewards from "rewards.js";
2017-06-08 02:56:52 +02:00
import { connect } from "react-redux";
import { doUserEmailDecline } from "actions/user";
import { doOpenModal } from "actions/app";
2017-06-01 18:20:12 +02:00
import {
selectAuthenticationIsPending,
2017-06-08 23:15:34 +02:00
selectUserHasEmail,
2017-06-08 02:56:52 +02:00
selectUserIsAuthRequested,
} from "selectors/user";
2017-06-28 20:00:10 +02:00
import { makeSelectHasClaimedReward } from "selectors/rewards";
2017-06-08 02:56:52 +02:00
import AuthOverlay from "./view";
2017-06-01 18:20:12 +02:00
2017-06-28 20:00:10 +02:00
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,
}),
};
};
2017-06-01 18:20:12 +02:00
2017-06-08 02:56:52 +02:00
const perform = dispatch => ({
userEmailDecline: () => dispatch(doUserEmailDecline()),
openWelcomeModal: () => dispatch(doOpenModal(modal.WELCOME)),
});
2017-06-01 18:20:12 +02:00
2017-06-08 02:56:52 +02:00
export default connect(select, perform)(AuthOverlay);