From bac202d4ec4c5b44c579aaef09ac848b7cab47ca Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 11 Mar 2019 09:47:14 +0100 Subject: [PATCH] Pending Rewards (#467) * show unclaimed rewards amount beside floating wallet balance --- .../component/floatingWalletBalance/index.js | 2 ++ .../component/floatingWalletBalance/view.js | 23 ++++++++++++------- app/src/component/rewardSummary/view.js | 8 +++---- app/src/page/discover/view.js | 2 -- app/src/page/rewards/view.js | 2 ++ app/src/styles/floatingButton.js | 22 ++++++++++++++++-- app/src/styles/reward.js | 20 ++++++++-------- 7 files changed, 51 insertions(+), 28 deletions(-) diff --git a/app/src/component/floatingWalletBalance/index.js b/app/src/component/floatingWalletBalance/index.js index 27e9e25d..e0ba24b4 100644 --- a/app/src/component/floatingWalletBalance/index.js +++ b/app/src/component/floatingWalletBalance/index.js @@ -1,9 +1,11 @@ import { connect } from 'react-redux'; import { selectBalance } from 'lbry-redux'; import FloatingWalletBalance from './view'; +import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc'; const select = state => ({ balance: selectBalance(state), + unclaimedRewardAmount: selectUnclaimedRewardValue(state), }); export default connect(select, null)(FloatingWalletBalance); diff --git a/app/src/component/floatingWalletBalance/view.js b/app/src/component/floatingWalletBalance/view.js index f48fb184..be0843f8 100644 --- a/app/src/component/floatingWalletBalance/view.js +++ b/app/src/component/floatingWalletBalance/view.js @@ -13,16 +13,23 @@ type Props = { class FloatingWalletBalance extends React.PureComponent { render() { - const { balance, navigation } = this.props; + const { balance, navigation, unclaimedRewardAmount } = this.props; return ( - navigation && navigation.navigate({ routeName: 'WalletStack' })}> - {isNaN(balance) && } - - {(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')} - - + + navigation && navigation.navigate({ routeName: 'WalletStack' })}> + {isNaN(balance) && } + + {(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')} + + + {unclaimedRewardAmount > 0 && + navigation && navigation.navigate({ routeName: 'Rewards' })} > + claim {unclaimedRewardAmount} + } + ); } } diff --git a/app/src/component/rewardSummary/view.js b/app/src/component/rewardSummary/view.js index 5009236b..20a847a2 100644 --- a/app/src/component/rewardSummary/view.js +++ b/app/src/component/rewardSummary/view.js @@ -56,14 +56,12 @@ class RewardSummary extends React.Component { } return ( - { - navigation.navigate('Rewards'); - }}> + - You have {unclaimedRewardAmount} LBC in unclaimed rewards. You have {this.state.actionsLeft} action{this.state.actionsLeft === 1 ? '' : 's'} left to claim your first reward. Tap here to continue. + You have {unclaimedRewardAmount} LBC in unclaimed rewards. LBC stands for LBRY Credits which are tokens that you can use in the digital marketplace. You have {this.state.actionsLeft} action{this.state.actionsLeft === 1 ? '' : 's'} left to claim your first reward.