From 0ae8bca3c8d8a73528799d003cf7739130d4c161 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Sat, 30 Jun 2018 13:52:18 +0100 Subject: [PATCH] REF: wallets list improvements --- BlueComponents.js | 6 ++--- loc/en.js | 7 ++++++ loc/index.js | 8 +++---- loc/ru.js | 7 ++++++ package-lock.json | 2 +- screen/wallets/list.js | 51 ++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 71 insertions(+), 10 deletions(-) diff --git a/BlueComponents.js b/BlueComponents.js index c9e7b5a0c..d65f6a535 100644 --- a/BlueComponents.js +++ b/BlueComponents.js @@ -529,7 +529,7 @@ export class BlueReceiveButtonIcon extends Component { flex: 1, position: 'absolute', bottom: 30, - left: (isIpad && 30) || 80, + left: (isIpad && 40) || 80, }} > @@ -592,7 +592,7 @@ export class BlueSendButtonIcon extends Component { flex: 1, position: 'absolute', bottom: 30, - right: (isIpad && 30) || 85, + right: (isIpad && 40) || 85, }} > @@ -814,7 +814,7 @@ export class WalletsCarousel extends Component { color: '#fff', }} > - latest transaction + {loc.wallets.list.latest_transaction} 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; } }; diff --git a/loc/ru.js b/loc/ru.js index 0087ec045..f0a9fdf7d 100644 --- a/loc/ru.js +++ b/loc/ru.js @@ -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: 'Добавить Кошелек', diff --git a/package-lock.json b/package-lock.json index f81836651..fd5ad0542 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "BlueWallet", - "version": "1.4.2", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/screen/wallets/list.js b/screen/wallets/list.js index 537658ba1..7be7311f0 100644 --- a/screen/wallets/list.js +++ b/screen/wallets/list.js @@ -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} - this.refreshTransactions()} /> + {(() => { + if (this.state.showRereshButton) { + return ( + this.refreshTransactions()} + /> + ); + } + })()} + + + + {(() => { + if ( + BlueApp.getTransactions(this.lastSnappedTo || 0) + .length === 0 + ) { + return ( + + + {loc.wallets.list.empty_txs1} + + + {loc.wallets.list.empty_txs2} + + + ); + } + })()}