lbry-desktop/ui/js/page/rewards/index.js

37 lines
1 KiB
JavaScript
Raw Normal View History

2017-06-08 02:56:52 +02:00
import React from "react";
import { connect } from "react-redux";
2017-07-16 18:29:46 +02:00
import {
makeSelectRewardByType,
selectFetchingRewards,
selectRewards,
} from "selectors/rewards";
2017-06-03 01:09:52 +02:00
import {
2017-06-08 02:56:52 +02:00
selectUserIsRewardEligible,
selectUserHasEmail,
selectUserIsVerificationCandidate,
} from "selectors/user";
2017-07-19 01:00:13 +02:00
import { doNavigate } from "actions/app";
2017-06-23 07:29:40 +02:00
import { doRewardList } from "actions/rewards";
2017-07-16 18:29:46 +02:00
import rewards from "rewards";
2017-06-08 02:56:52 +02:00
import RewardsPage from "./view";
2017-05-26 10:53:32 +02:00
2017-07-16 18:29:46 +02:00
const select = (state, props) => {
const selectReward = makeSelectRewardByType();
return {
fetching: selectFetchingRewards(state),
rewards: selectRewards(state),
hasEmail: selectUserHasEmail(state),
isEligible: selectUserIsRewardEligible(state),
isVerificationCandidate: selectUserIsVerificationCandidate(state),
newUserReward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
};
};
2017-05-26 10:53:32 +02:00
2017-06-23 07:29:40 +02:00
const perform = dispatch => ({
fetchRewards: () => dispatch(doRewardList()),
2017-07-19 01:00:13 +02:00
doAuth: () => dispatch(doNavigate("/auth")),
2017-06-23 07:29:40 +02:00
});
export default connect(select, perform)(RewardsPage);