2017-06-08 02:56:52 +02:00
|
|
|
import React from "react";
|
2017-06-08 23:15:34 +02:00
|
|
|
import rewards from "rewards";
|
2017-06-08 02:56:52 +02:00
|
|
|
import { connect } from "react-redux";
|
|
|
|
import { doCloseModal } from "actions/app";
|
|
|
|
import { selectUserIsRewardApproved } from "selectors/user";
|
2017-06-08 23:15:34 +02:00
|
|
|
import {
|
|
|
|
makeSelectHasClaimedReward,
|
|
|
|
makeSelectClaimRewardError,
|
|
|
|
makeSelectRewardByType,
|
|
|
|
} from "selectors/rewards";
|
2017-07-10 19:19:42 +02:00
|
|
|
import ModalWelcome from "./view";
|
2017-06-08 02:56:52 +02:00
|
|
|
|
|
|
|
const select = (state, props) => {
|
2017-06-08 23:15:34 +02:00
|
|
|
const selectHasClaimed = makeSelectHasClaimedReward(),
|
|
|
|
selectReward = makeSelectRewardByType();
|
2017-06-08 02:56:52 +02:00
|
|
|
|
|
|
|
return {
|
2017-06-08 23:15:34 +02:00
|
|
|
hasClaimed: selectHasClaimed(state, { reward_type: rewards.TYPE_NEW_USER }),
|
2017-06-08 02:56:52 +02:00
|
|
|
isRewardApproved: selectUserIsRewardApproved(state),
|
2017-06-08 23:15:34 +02:00
|
|
|
reward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
|
2017-06-08 02:56:52 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
|
|
|
closeModal: () => dispatch(doCloseModal()),
|
|
|
|
});
|
|
|
|
|
2017-07-10 19:19:42 +02:00
|
|
|
export default connect(select, perform)(ModalWelcome);
|