REF: wallets list improvements

This commit is contained in:
Overtorment 2018-06-30 13:52:18 +01:00
parent e52c196009
commit 0ae8bca3c8
6 changed files with 71 additions and 10 deletions

View file

@ -529,7 +529,7 @@ export class BlueReceiveButtonIcon extends Component {
flex: 1,
position: 'absolute',
bottom: 30,
left: (isIpad && 30) || 80,
left: (isIpad && 40) || 80,
}}
>
<View>
@ -592,7 +592,7 @@ export class BlueSendButtonIcon extends Component {
flex: 1,
position: 'absolute',
bottom: 30,
right: (isIpad && 30) || 85,
right: (isIpad && 40) || 85,
}}
>
<View>
@ -814,7 +814,7 @@ export class WalletsCarousel extends Component {
color: '#fff',
}}
>
latest transaction
{loc.wallets.list.latest_transaction}
</Text>
<Text
style={{

View file

@ -4,6 +4,10 @@ module.exports = {
'Your storage is encrypted. Password is required to decrypt it',
enter_password: 'Enter password',
bad_password: 'Bad pasword, try again',
months_ago: 'months ago',
days_ago: 'days ago',
hours_ago: 'hours ago',
never: 'never',
},
wallets: {
list: {
@ -17,6 +21,9 @@ module.exports = {
create_a_wallet: 'Create a wallet',
create_a_wallet1: "It's free and you can create",
create_a_wallet2: 'as many as you like',
latest_transaction: 'latest transaction',
empty_txs1: 'Your transactions will appear here,',
empty_txs2: 'none at the moment',
},
add: {
title: 'add wallet',

View file

@ -47,19 +47,19 @@ strings.saveLanguage = lang => AsyncStorage.setItem(AppStorage.LANG, lang);
strings.transactionTimeToReadable = function(time) {
if (time === 0) {
return 'never';
return strings._.never;
}
let ago = (Date.now() - Date.parse(time)) / 1000; // seconds
if (ago / (3600 * 24) >= 30) {
ago = Math.round(ago / (3600 * 24 * 30));
return ago + ' months ago';
return ago + ' ' + strings._.months_ago;
} else if (ago / (3600 * 24) >= 1) {
ago = Math.round(ago / (3600 * 24));
return ago + ' days ago';
return ago + ' ' + strings._.days_ago;
} else {
ago = Math.round(ago / 3600);
return ago + ' hours ago';
return ago + ' ' + strings._.hours_ago;
}
};

View file

@ -4,6 +4,10 @@ module.exports = {
'Ваше хранилище зашифровано. Введите пароль для расшифровки',
enter_password: 'Введите пароль',
bad_password: 'Неверный пароль, попробуйте еще раз',
months_ago: 'месяцев назад',
days_ago: 'дней назад',
hours_ago: 'часов назад',
never: 'никогда',
},
wallets: {
list: {
@ -16,6 +20,9 @@ module.exports = {
create_a_wallet: 'Создать кошелек',
create_a_wallet1: 'Это бесплатно и вы можете создать',
create_a_wallet2: 'неограниченное количество',
latest_transaction: 'последняя транзакция',
empty_txs1: 'Список транзакций пока пуст',
empty_txs2: ' ',
},
add: {
title: 'Добавить Кошелек',

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "BlueWallet",
"version": "1.4.2",
"version": "2.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -72,6 +72,7 @@ export default class WalletsList extends Component {
isTransactionsLoading: false,
showReceiveButton: true,
showSendButton: true,
showRereshButton: true,
final_balance: BlueApp.getBalance(),
dataSource: ds.cloneWithRows(
BlueApp.getTransactions(this.lastSnappedTo || 0),
@ -137,6 +138,7 @@ export default class WalletsList extends Component {
isLoading: false,
showReceiveButton: false,
showSendButton: false,
showRereshButton: false,
final_balance: BlueApp.getBalance(),
dataSource: ds.cloneWithRows(BlueApp.getTransactions(index)),
});
@ -144,7 +146,12 @@ export default class WalletsList extends Component {
if (index < BlueApp.getWallets().length) {
// do not show for last card
setTimeout(
() => this.setState({ showReceiveButton: true, showSendButton: true }),
() =>
this.setState({
showReceiveButton: true,
showSendButton: true,
showRereshButton: true,
}),
50,
); // just to animate it, no real function
}
@ -192,7 +199,47 @@ export default class WalletsList extends Component {
>
{loc.transactions.list.title}
</Text>
<BlueRefreshIcon onPress={() => this.refreshTransactions()} />
{(() => {
if (this.state.showRereshButton) {
return (
<BlueRefreshIcon
onPress={() => this.refreshTransactions()}
/>
);
}
})()}
</View>
<View style={{ top: 120, position: 'absolute', width: width }}>
{(() => {
if (
BlueApp.getTransactions(this.lastSnappedTo || 0)
.length === 0
) {
return (
<View>
<Text
style={{
fontSize: 18,
color: '#9aa0aa',
textAlign: 'center',
}}
>
{loc.wallets.list.empty_txs1}
</Text>
<Text
style={{
fontSize: 18,
color: '#9aa0aa',
textAlign: 'center',
}}
>
{loc.wallets.list.empty_txs2}
</Text>
</View>
);
}
})()}
</View>
<View style={{ top: 30, position: 'absolute' }}>