update text for signed in users #89

Merged
akinwale merged 2 commits from wallet-rewards-driver into master 2019-12-06 16:01:25 +01:00
2 changed files with 23 additions and 6 deletions

View file

@ -1,9 +1,10 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectUnclaimedRewardValue } from 'lbryinc'; import { selectUnclaimedRewardValue, selectUser } from 'lbryinc';
import WalletRewardsDriver from './view'; import WalletRewardsDriver from './view';
const select = state => ({ const select = state => ({
unclaimedRewardAmount: selectUnclaimedRewardValue(state), unclaimedRewardAmount: selectUnclaimedRewardValue(state),
user: selectUser(state),
}); });
export default connect(select)(WalletRewardsDriver); export default connect(select)(WalletRewardsDriver);

View file

@ -5,15 +5,31 @@ import walletStyle from 'styles/wallet';
class WalletRewardsDriver extends React.PureComponent<Props> { class WalletRewardsDriver extends React.PureComponent<Props> {
render() { render() {
const { navigation, unclaimedRewardAmount } = this.props; const { navigation, unclaimedRewardAmount, user } = this.props;
const signedIn = user && user.has_verified_email;
return ( return (
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}> <TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={walletStyle.rewardIcon} /> <Icon name="award" size={16} style={walletStyle.rewardIcon} />
<Text style={walletStyle.rewardDriverText}> {signedIn && (
Get {unclaimedRewardAmount > 0 ? unclaimedRewardAmount : ''} free credit <Text style={walletStyle.rewardDriverText}>
{unclaimedRewardAmount === 1 ? '' : 's'} after creating an account. {unclaimedRewardAmount === 0 && __('Free credits available in rewards.')}
</Text> {unclaimedRewardAmount === 1 &&
__('%amount% free credit available in rewards.', { amount: unclaimedRewardAmount })}
{unclaimedRewardAmount > 1 &&
__('%amount% free credits available in rewards.', { amount: unclaimedRewardAmount })}{' '}
{__('Tap to learn more.')}
</Text>
)}
{!signedIn && (
<Text style={walletStyle.rewardDriverText}>
{unclaimedRewardAmount === 1 &&
__('Get %amount% free credit after creating an account.', { amount: unclaimedRewardAmount })}
{unclaimedRewardAmount !== 1 &&
__('Get %amount% free credits after creating an account.', { amount: unclaimedRewardAmount })}
</Text>
)}
</TouchableOpacity> </TouchableOpacity>
); );
} }