From 3edec5e597a02e9b5eb93e547e25ea1cd3847402 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 4 Dec 2014 10:36:58 -0300 Subject: [PATCH] simplify receive and wallet home tab --- js/controllers/homeWallet.js | 11 ++- js/controllers/receive.js | 58 +++++++++----- views/homeWallet.html | 84 +++++++++----------- views/includes/transaction.html | 6 +- views/includes/version.html | 1 - views/receive.html | 137 +++++++++++++++++++------------- views/send.html | 14 ++-- 7 files changed, 174 insertions(+), 137 deletions(-) diff --git a/js/controllers/homeWallet.js b/js/controllers/homeWallet.js index 788e937b8..d94fb3218 100644 --- a/js/controllers/homeWallet.js +++ b/js/controllers/homeWallet.js @@ -4,13 +4,12 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi $scope.init = function() { $rootScope.title = 'Home'; - $scope.addr = _.last($rootScope.wallet.getReceiveAddresses()); // This is necesarry, since wallet can change in homeWallet, without running init() again. - $rootScope.$watch('wallet', function() { - if ($rootScope.wallet && $rootScope.wallet.isComplete()) { - $scope.addr = _.last($rootScope.wallet.getReceiveAddresses()); - } - }); + // $rootScope.$watch('wallet', function() { + // if ($rootScope.wallet && $rootScope.wallet.isComplete()) { + // $scope.addr = _.last($rootScope.wallet.getReceiveAddresses()); + // } + // }); }; }); diff --git a/js/controllers/receive.js b/js/controllers/receive.js index 6481d09b3..660a02417 100644 --- a/js/controllers/receive.js +++ b/js/controllers/receive.js @@ -2,9 +2,6 @@ angular.module('copayApp.controllers').controller('ReceiveController', function($scope, $rootScope, $timeout, $modal) { - $rootScope.title = 'Receive'; - $scope.loading = false; - $scope.showAll = false; $scope.newAddr = function() { var w = $rootScope.wallet; @@ -16,6 +13,25 @@ angular.module('copayApp.controllers').controller('ReceiveController', }, 1); }; + $scope.init = function() { + $rootScope.title = 'Receive'; + $scope.showAll = false; + + var w = $rootScope.wallet; + var lastAddr = _.first(w.getAddressesOrderer()); + var balance = w.balanceInfo.balanceByAddr; + + if (balance[lastAddr]>0) + $scope.loading = true; + + while (balance && balance[lastAddr] > 0) { + $scope.newAddr(); + lastAddr = w.generateAddress(null); + }; + $scope.loading = false; + $scope.addr = lastAddr; + }; + $scope.openAddressModal = function(address) { var ModalInstanceCtrl = function($scope, $modalInstance, address) { $scope.address = address; @@ -43,26 +59,30 @@ angular.module('copayApp.controllers').controller('ReceiveController', }; $scope.setAddressList = function() { - var w = $rootScope.wallet; - var balance = w.balanceInfo.balanceByAddr; + if ($scope.showAll) { + var w = $rootScope.wallet; + var balance = w.balanceInfo.balanceByAddr; - var addresses = w.getAddressesOrderer(); - if (addresses) { - $scope.addrLength = addresses.length; + var addresses = w.getAddressesOrderer(); + if (addresses) { + $scope.addrLength = addresses.length; - if (!$scope.showAll) - addresses = addresses.slice(0,3); + if (!$scope.showAll) + addresses = addresses.slice(0, 3); - var list = []; - _.each(addresses, function(address, index){ - list.push({ - 'index': index, - 'address': address, - 'balance': balance ? balance[address] : null, - 'isChange': w.addressIsChange(address), + var list = []; + _.each(addresses, function(address, index) { + list.push({ + 'index': index, + 'address': address, + 'balance': balance ? balance[address] : null, + 'isChange': w.addressIsChange(address), + }); }); - }); - $scope.addresses = list; + $scope.addresses = list; + } + } else { + $scope.addresses = []; } }; } diff --git a/views/homeWallet.html b/views/homeWallet.html index 798473247..a0c3cff12 100644 --- a/views/homeWallet.html +++ b/views/homeWallet.html @@ -1,63 +1,57 @@
-
-
-

Home

-
+
+
+

Home

+
-
-
-
-
-
-
{{$root.wallet.getName() | limitTo: 1}}
-

{{$root.wallet.getName()}}

-
-
-
- +
+
+
+
+
+
{{$root.wallet.getName() | limitTo: 1}}
+

{{$root.wallet.getName()}}

+
+
+
+ {{$root.wallet.balanceInfo.totalBalance || 0}} - - {{$root.wallet.settings.unitName}} - - - + + {{$root.wallet.settings.unitName}} + + + {{$root.wallet.balanceInfo.totalBalanceAlternative}} {{$root.wallet.balanceInfo.alternativeIsoCode}} - N/A - - -
-
-
-
-
-
- -
- -
-
-

Quick receive

-
- - -
-

{{addr}}

- - + N/A +
+
+
+
+ Personal Wallet + + Multisignature wallet [{{$root.wallet.requiredCopayers}} of {{$root.wallet.totalCopayers}} ] + + in TESTNET +
+
+
+
+ +
-
+

Copayers

-
+
-
+
diff --git a/views/includes/transaction.html b/views/includes/transaction.html index 78893e0af..36b505929 100644 --- a/views/includes/transaction.html +++ b/views/includes/transaction.html @@ -41,12 +41,12 @@
@@ -79,7 +79,7 @@ Fee: {{tx.fee}} {{$root.wallet.settings.unitName}}
- Proposal ID: {{tx.ntxid}} + Proposal ID: {{tx.ntxid}}
diff --git a/views/includes/version.html b/views/includes/version.html index 771d2717f..82325c290 100644 --- a/views/includes/version.html +++ b/views/includes/version.html @@ -1,6 +1,5 @@
v{{version}} #{{commitHash}} - [TESTNET]
diff --git a/views/receive.html b/views/receive.html index e593d4627..02abb6cd3 100644 --- a/views/receive.html +++ b/views/receive.html @@ -1,67 +1,92 @@ -
-
-
-

{{$root.title}}

-
- -
-
+
+
+
+

{{$root.title}}

-
-
-
-
-
-
-
- - change -
-
-
- - - - - {{addr.balance || '0'}} {{$root.wallet.settings.unitName}} - -
- +
+ +
+ +
+
+
+

My Bitcoin address:

+
+ +
+

{{addr}}

-
-
-
-
- - change -
-
- - - - - {{addr.balance || '0'}} {{$root.wallet.settings.unitName}} - -
-
-
-
+
+
+ Generating new address... +
+
+
+
+ Share this with anyone to have them send you payments. To protect your privacy, new addresses are generated automatically once you use them.
- +
+
+
+
+
+
+
+ + change +
+
+
+ + + + + {{addr.balance || '0'}} {{$root.wallet.settings.unitName}} + +
+ +
+
+
+
+
+ + change +
+
+ + + + + {{addr.balance || '0'}} {{$root.wallet.settings.unitName}} + +
+
+
+
+
- - Add +
+ + Generate new address + + + Hide them + +
+ +
diff --git a/views/send.html b/views/send.html index b9552528e..432265057 100644 --- a/views/send.html +++ b/views/send.html @@ -1,4 +1,11 @@
+
+
+
+

{{$root.title}}

+
+
+

Pending Transactions Proposals

@@ -8,13 +15,6 @@
-
-
-
-

{{$root.title}}

-
-
-

Create Transaction Proposal