Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
817fdf38a6 | ||
|
|
e137e8f76c | ||
|
|
ab84327659 |
No files matched your search
@@ -1,10 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnclaimedRewardValue, selectUser } from 'lbryinc';
|
||||
import { selectUnclaimedRewardValue } from 'lbryinc';
|
||||
import WalletRewardsDriver from './view';
|
||||
|
||||
const select = state => ({
|
||||
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
export default connect(select)(WalletRewardsDriver);
|
||||
@@ -5,31 +5,15 @@ import walletStyle from 'styles/wallet';
|
||||
|
||||
class WalletRewardsDriver extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { navigation, unclaimedRewardAmount, user } = this.props;
|
||||
const signedIn = user && user.has_verified_email;
|
||||
const { navigation, unclaimedRewardAmount } = this.props;
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
|
||||
{signedIn && (
|
||||
<Text style={walletStyle.rewardDriverText}>
|
||||
{unclaimedRewardAmount === 0 && __('Free credits available in rewards.')}
|
||||
{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>
|
||||
)}
|
||||
<Text style={walletStyle.rewardDriverText}>
|
||||
Get {unclaimedRewardAmount > 0 ? unclaimedRewardAmount : ''} free credit
|
||||
{unclaimedRewardAmount === 1 ? '' : 's'} after creating an account.
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
+8
-10
@@ -170,8 +170,8 @@ class SplashScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
_updateStatusCallback(status) {
|
||||
console.log(status);
|
||||
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
|
||||
const blockchainHeaders = status.blockchain_headers;
|
||||
const startupStatus = status.startup_status;
|
||||
const walletStatus = status.wallet;
|
||||
|
||||
@@ -222,11 +222,10 @@ class SplashScreen extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const headerSyncProgress = walletStatus.headers_synchronization_progress;
|
||||
if (headerSyncProgress && headerSyncProgress < 100) {
|
||||
if (blockchainHeaders) {
|
||||
this.setState({
|
||||
isDownloadingHeaders: true,
|
||||
headersDownloadProgress: headerSyncProgress,
|
||||
isDownloadingHeaders: blockchainHeaders.downloading_headers,
|
||||
headersDownloadProgress: blockchainHeaders.download_progress,
|
||||
});
|
||||
} else {
|
||||
// set downloading flag to false if blockchain_headers isn't in the status response
|
||||
@@ -235,16 +234,15 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
if (headerSyncProgress < 100) {
|
||||
const downloadProgress = headerSyncProgress || 0;
|
||||
if (blockchainHeaders && blockchainHeaders.downloading_headers) {
|
||||
const downloadProgress = blockchainHeaders.download_progress ? blockchainHeaders.download_progress : 0;
|
||||
this.setState({
|
||||
message: __('Blockchain Sync'),
|
||||
details: __('Catching up with the blockchain (%progress%%)', { progress: downloadProgress }),
|
||||
details: `Catching up with the blockchain (${downloadProgress}%)`, // TODO: i18n tokenization
|
||||
});
|
||||
} else if (walletStatus && walletStatus.blocks_behind > 0) {
|
||||
const behind = walletStatus.blocks_behind;
|
||||
const behindText =
|
||||
behind === 1 ? __('%num% block behind', { num: behind }) : __('%num% blocks behind', { num: behind });
|
||||
const behindText = behind + ' block' + (behind === 1 ? '' : 's') + ' behind'; // TODO: i18n tokenization
|
||||
this.setState({
|
||||
message: __('Blockchain Sync'),
|
||||
details: behindText,
|
||||
|
||||
Reference in new issue
Block a user