Pending Rewards #467

Merged
akinwale merged 3 commits from pending-rewards into master 2019-03-11 09:47:15 +01:00
6 changed files with 22 additions and 24 deletions
Showing only changes of commit f1cc5151b5 - Show all commits

View file

@ -1,9 +1,11 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectBalance } from 'lbry-redux'; import { selectBalance } from 'lbry-redux';
import FloatingWalletBalance from './view'; import FloatingWalletBalance from './view';
import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc';
const select = state => ({ const select = state => ({
balance: selectBalance(state), balance: selectBalance(state),
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
}); });
export default connect(select, null)(FloatingWalletBalance); export default connect(select, null)(FloatingWalletBalance);

View file

@ -13,7 +13,7 @@ type Props = {
class FloatingWalletBalance extends React.PureComponent<Props> { class FloatingWalletBalance extends React.PureComponent<Props> {
render() { render() {
const { balance, navigation } = this.props; const { balance, navigation, unclaimedRewardAmount } = this.props;
return ( return (
<View style={[floatingButtonStyle.view, floatingButtonStyle.bottomRight]}> <View style={[floatingButtonStyle.view, floatingButtonStyle.bottomRight]}>
@ -24,11 +24,11 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
{(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')} {(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={floatingButtonStyle.pendingContainer}> {unclaimedRewardAmount > 0 &&
<Text style={floatingButtonStyle.text}> <TouchableOpacity style={floatingButtonStyle.pendingContainer}
get 40 onPress={() => navigation && navigation.navigate({ routeName: 'Rewards' })} >
</Text> <Text style={floatingButtonStyle.text}>claim {unclaimedRewardAmount}</Text>
</TouchableOpacity> </TouchableOpacity>}
</View> </View>
); );
} }

View file

@ -56,14 +56,12 @@ class RewardSummary extends React.Component {
} }
return ( return (
<TouchableOpacity style={rewardStyle.summaryContainer} onPress={() => { <View style={rewardStyle.summaryContainer}>
navigation.navigate('Rewards');
}}>
<Text style={rewardStyle.summaryText}> <Text style={rewardStyle.summaryText}>
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.
</Text> </Text>
<Button style={rewardStyle.dismissButton} theme={"light"} text={"Dismiss"} onPress={this.onDismissPressed} /> <Button style={rewardStyle.dismissButton} theme={"light"} text={"Dismiss"} onPress={this.onDismissPressed} />
</TouchableOpacity> </View>
); );
} }
} }

View file

@ -17,7 +17,6 @@ import Colors from 'styles/colors';
import discoverStyle from 'styles/discover'; import discoverStyle from 'styles/discover';
import FloatingWalletBalance from 'component/floatingWalletBalance'; import FloatingWalletBalance from 'component/floatingWalletBalance';
import FileItem from 'component/fileItem'; import FileItem from 'component/fileItem';
import RewardSummary from 'component/rewardSummary';
import UriBar from 'component/uriBar'; import UriBar from 'component/uriBar';
class DiscoverPage extends React.PureComponent { class DiscoverPage extends React.PureComponent {
@ -159,7 +158,6 @@ class DiscoverPage extends React.PureComponent {
return ( return (
<View style={discoverStyle.container}> <View style={discoverStyle.container}>
<UriBar navigation={navigation} /> <UriBar navigation={navigation} />
<RewardSummary navigation={navigation} />
{!hasContent && fetchingFeaturedUris && ( {!hasContent && fetchingFeaturedUris && (
<View style={discoverStyle.busyContainer}> <View style={discoverStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} /> <ActivityIndicator size="large" color={Colors.LbryGreen} />

View file

@ -14,6 +14,7 @@ import PhoneNumberRewardSubcard from 'component/phoneNumberRewardSubcard';
import EmailRewardSubcard from 'component/emailRewardSubcard'; import EmailRewardSubcard from 'component/emailRewardSubcard';
import PageHeader from 'component/pageHeader'; import PageHeader from 'component/pageHeader';
import RewardCard from 'component/rewardCard'; import RewardCard from 'component/rewardCard';
import RewardSummary from 'component/rewardSummary';
import UriBar from 'component/uriBar'; import UriBar from 'component/uriBar';
import rewardStyle from 'styles/reward'; import rewardStyle from 'styles/reward';
@ -144,6 +145,7 @@ class RewardsPage extends React.PureComponent {
keyboardShouldPersistTaps={'handled'} keyboardShouldPersistTaps={'handled'}
style={rewardStyle.scrollContainer} style={rewardStyle.scrollContainer}
contentContainerStyle={rewardStyle.scrollContentContainer}> contentContainerStyle={rewardStyle.scrollContentContainer}>
<RewardSummary navigation={navigation} />
{this.renderVerification()} {this.renderVerification()}
{this.renderUnclaimedRewards()} {this.renderUnclaimedRewards()}
{this.renderClaimedRewards()} {this.renderClaimedRewards()}

View file

@ -159,17 +159,15 @@ const rewardStyle = StyleSheet.create({
summaryContainer: { summaryContainer: {
backgroundColor: Colors.LbryGreen, backgroundColor: Colors.LbryGreen,
padding: 12, padding: 12,
marginTop: 60, marginTop: 16,
marginBottom: -60, marginLeft: 16,
flexDirection: 'row', marginRight: 16,
justifyContent: 'space-between',
alignItems: 'center'
}, },
summaryText: { summaryText: {
color: Colors.White, color: Colors.White,
fontFamily: 'Inter-UI-Regular', fontFamily: 'Inter-UI-Regular',
fontSize: 14, fontSize: 16,
lineHeight: 20, lineHeight: 24,
flex: 0.7 flex: 0.7
}, },
phoneVerificationContainer: { phoneVerificationContainer: {
@ -202,11 +200,11 @@ const rewardStyle = StyleSheet.create({
marginBottom: 32 marginBottom: 32
}, },
dismissButton: { dismissButton: {
alignSelf: 'center', alignSelf: 'flex-end',
backgroundColor: Colors.White, backgroundColor: Colors.White,
paddingLeft: 4, paddingLeft: 16,
paddingRight: 4, paddingRight: 16,
flex: 0.2 marginTop: 8,
}, },
customCodeInput: { customCodeInput: {
fontFamily: 'Inter-UI-Regular', fontFamily: 'Inter-UI-Regular',