From 2fb0bf4a14a12b72709028f2e9f5850a939dd9b9 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Fri, 25 Aug 2017 15:51:54 -0400 Subject: [PATCH] invites for all --- ui/js/actions/user.js | 4 +++- ui/js/component/inviteList/view.jsx | 15 ++++++++++++--- ui/js/component/inviteNew/view.jsx | 23 +++++++++-------------- ui/js/component/rewardLink/view.jsx | 5 ++++- ui/js/rewards.js | 1 + ui/js/selectors/search.js | 1 + 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/ui/js/actions/user.js b/ui/js/actions/user.js index 397b3d457..2267621d1 100644 --- a/ui/js/actions/user.js +++ b/ui/js/actions/user.js @@ -187,7 +187,9 @@ export function doFetchInviteStatus() { dispatch({ type: types.USER_INVITE_STATUS_FETCH_SUCCESS, data: { - invitesRemaining: status.invites_remaining, + invitesRemaining: status.invites_remaining + ? status.invites_remaining + : 0, invitees: status.invitees, }, }); diff --git a/ui/js/component/inviteList/view.jsx b/ui/js/component/inviteList/view.jsx index 8d3d4962d..f729352a0 100644 --- a/ui/js/component/inviteList/view.jsx +++ b/ui/js/component/inviteList/view.jsx @@ -1,5 +1,7 @@ import React from "react"; import { Icon } from "component/common"; +import RewardLink from "component/rewardLink"; +import rewards from "rewards.js"; class InviteList extends React.PureComponent { render() { @@ -38,11 +40,18 @@ class InviteList extends React.PureComponent { {invitee.email} - {invitee.invite_accepted && } + {invitee.invite_accepted + ? + : {__("unused")}} - {invitee.invite_reward_claimed && - } + {invitee.invite_reward_claimed + ? + : } ); diff --git a/ui/js/component/inviteNew/view.jsx b/ui/js/component/inviteNew/view.jsx index a02f0054b..6dc2d0f01 100644 --- a/ui/js/component/inviteNew/view.jsx +++ b/ui/js/component/inviteNew/view.jsx @@ -73,25 +73,20 @@ class InviteNew extends React.PureComponent { )} + {/*
{invitesRemaining > 0 &&

{__("You have %s invites remaining.", invitesRemaining)}

} {invitesRemaining <= 0 && -

- - {__("You have no invites.", invitesRemaining)} - -

} +

{__("You have no invites.")}

} +
*/} +
+
- {!inviteStatusIsPending && - invitesRemaining > 0 && -
- -
} ); } diff --git a/ui/js/component/rewardLink/view.jsx b/ui/js/component/rewardLink/view.jsx index 1f36dd86e..4f019fcf2 100644 --- a/ui/js/component/rewardLink/view.jsx +++ b/ui/js/component/rewardLink/view.jsx @@ -9,6 +9,7 @@ const RewardLink = props => { claimReward, clearError, errorMessage, + label, isPending, } = props; @@ -17,7 +18,9 @@ const RewardLink = props => { { claimReward(reward); }} diff --git a/ui/js/rewards.js b/ui/js/rewards.js index fd952032c..8430c7f31 100644 --- a/ui/js/rewards.js +++ b/ui/js/rewards.js @@ -95,6 +95,7 @@ rewards.TYPE_FIRST_STREAM = "first_stream"; rewards.TYPE_MANY_DOWNLOADS = "many_downloads"; rewards.TYPE_FIRST_PUBLISH = "first_publish"; rewards.TYPE_FEATURED_DOWNLOAD = "featured_download"; +rewards.TYPE_REFERRAL = "referral"; rewards.claimReward = function(type) { function requestReward(resolve, reject, params) { diff --git a/ui/js/selectors/search.js b/ui/js/selectors/search.js index 4902a99c4..2a77ebe9a 100644 --- a/ui/js/selectors/search.js +++ b/ui/js/selectors/search.js @@ -61,6 +61,7 @@ export const selectWunderBarIcon = createSelector(selectCurrentPage, page => { case "invite": return "icon-envelope-open"; case "address": + case "receive": return "icon-address-book"; case "wallet": case "backup":