Pending Rewards (#467)
* show unclaimed rewards amount beside floating wallet balance
This commit is contained in:
parent
bb8d856d17
commit
bac202d4ec
7 changed files with 51 additions and 28 deletions
|
@ -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);
|
||||||
|
|
|
@ -13,16 +13,23 @@ 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 (
|
||||||
<TouchableOpacity style={[floatingButtonStyle.container, floatingButtonStyle.bottomRight]}
|
<View style={[floatingButtonStyle.view, floatingButtonStyle.bottomRight]}>
|
||||||
|
<TouchableOpacity style={floatingButtonStyle.container}
|
||||||
onPress={() => navigation && navigation.navigate({ routeName: 'WalletStack' })}>
|
onPress={() => navigation && navigation.navigate({ routeName: 'WalletStack' })}>
|
||||||
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
||||||
<Text style={floatingButtonStyle.text}>
|
<Text style={floatingButtonStyle.text}>
|
||||||
{(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')}
|
{(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
{unclaimedRewardAmount > 0 &&
|
||||||
|
<TouchableOpacity style={floatingButtonStyle.pendingContainer}
|
||||||
|
onPress={() => navigation && navigation.navigate({ routeName: 'Rewards' })} >
|
||||||
|
<Text style={floatingButtonStyle.text}>claim {unclaimedRewardAmount}</Text>
|
||||||
|
</TouchableOpacity>}
|
||||||
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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} />
|
||||||
|
|
|
@ -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()}
|
||||||
|
|
|
@ -2,8 +2,15 @@ import { StyleSheet } from 'react-native';
|
||||||
import Colors from './colors';
|
import Colors from './colors';
|
||||||
|
|
||||||
const floatingButtonStyle = StyleSheet.create({
|
const floatingButtonStyle = StyleSheet.create({
|
||||||
container: {
|
view: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
zIndex: 100,
|
||||||
|
borderRadius: 24,
|
||||||
|
padding: 14,
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
flexDirection: 'row'
|
||||||
|
},
|
||||||
|
container: {
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
borderRadius: 24,
|
borderRadius: 24,
|
||||||
padding: 14,
|
padding: 14,
|
||||||
|
@ -11,7 +18,7 @@ const floatingButtonStyle = StyleSheet.create({
|
||||||
paddingRight: 20,
|
paddingRight: 20,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
backgroundColor: Colors.BrighterLbryGreen,
|
backgroundColor: Colors.LbryGreen,
|
||||||
shadowColor: 'black',
|
shadowColor: 'black',
|
||||||
shadowOpacity: 0.1,
|
shadowOpacity: 0.1,
|
||||||
shadowRadius: StyleSheet.hairlineWidth,
|
shadowRadius: StyleSheet.hairlineWidth,
|
||||||
|
@ -20,6 +27,17 @@ const floatingButtonStyle = StyleSheet.create({
|
||||||
},
|
},
|
||||||
elevation: 4
|
elevation: 4
|
||||||
},
|
},
|
||||||
|
pendingContainer: {
|
||||||
|
borderRadius: 24,
|
||||||
|
padding: 14,
|
||||||
|
paddingLeft: 70,
|
||||||
|
paddingRight: 20,
|
||||||
|
marginLeft: -60,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
backgroundColor: Colors.BrighterLbryGreen,
|
||||||
|
elevation: 3
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
color: Colors.White,
|
color: Colors.White,
|
||||||
fontFamily: 'Inter-UI-Bold',
|
fontFamily: 'Inter-UI-Bold',
|
||||||
|
|
|
@ -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',
|
||||||
|
|
Loading…
Reference in a new issue