From 0c5defaadb3797e6d898c663b405061d61201377 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Mon, 29 May 2017 12:56:19 +0200 Subject: [PATCH 1/8] - Fix the issue caused by renaming from transfer to send. - Fix an issue with sending floating point values --- src/components/send/send.js | 6 +++--- src/components/send/sendModalService.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/send/send.js b/src/components/send/send.js index a057d2ebe..f3c8fbdd3 100644 --- a/src/components/send/send.js +++ b/src/components/send/send.js @@ -10,7 +10,7 @@ app.component('send', { template: require('./send.pug')(), bindings: { recipientId: '<', - transferAmount: '<', + sendAmount: '<', }, /** * The send component constructor class @@ -40,8 +40,8 @@ app.component('send', { /** * @todo Check if it's possible to replace these watchers with filters. */ - if ($scope.$ctrl.transferAmount) { - this.amount.value = parseInt(lsk.normalize($scope.$ctrl.transferAmount), 10); + if ($scope.$ctrl.sendAmount) { + this.amount.value = parseFloat(lsk.normalize($scope.$ctrl.sendAmount), 10); } this.$scope.$watch('$ctrl.amount.value', () => { diff --git a/src/components/send/sendModalService.js b/src/components/send/sendModalService.js index 4132a8b7c..dca4cd2da 100644 --- a/src/components/send/sendModalService.js +++ b/src/components/send/sendModalService.js @@ -33,7 +33,7 @@ app.factory('SendModal', ($mdDialog) => { bindToController: true, controller: ['$scope', ($scope) => { $scope.recipientId = recipientId; - $scope.amount = amount; + $scope.sendAmount = amount; }], controllerAs: 'ms', })); From 4e6f485c8ac4eb59d3db464a1d5c9105528d234f Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Mon, 29 May 2017 12:57:16 +0200 Subject: [PATCH 2/8] Add possibility for send all funds by clicking on account balance --- src/components/top/top.js | 6 +++++- src/components/top/top.less | 8 ++++++++ src/components/top/top.pug | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/components/top/top.js b/src/components/top/top.js index 1b86edcd4..27a29382a 100644 --- a/src/components/top/top.js +++ b/src/components/top/top.js @@ -9,9 +9,13 @@ import './top.less'; app.component('top', { template: require('./top.pug')(), controller: class top { - constructor(Peers, Account) { + constructor($scope,Peers, Account) { this.peers = Peers; this.account = Account; + + $scope.$on('accountChange', () => { + this.totalSendable = this.account.get().balance > 1e7 ? this.account.get().balance - 1e7 : 0; + }); } }, }); diff --git a/src/components/top/top.less b/src/components/top/top.less index 5aecee13b..7a9bee9dc 100644 --- a/src/components/top/top.less +++ b/src/components/top/top.less @@ -42,4 +42,12 @@ top { font-size: 120%; font-weight: bold; } + + .balance { + display: inline-block; + line-height: 41px; + &.has-send-modal { + cursor: pointer; + } + } } diff --git a/src/components/top/top.pug b/src/components/top/top.pug index 02e844056..121788d0c 100644 --- a/src/components/top/top.pug +++ b/src/components/top/top.pug @@ -21,4 +21,6 @@ md-content(layout='column', layout-gt-xs='row') md-card.offline-hide(flex-gt-xs=33) md-card-content(layout='column', layout-align='center center') span.md-title.title Balance - lsk.balance.value(amount='$ctrl.account.get().balance', nocolor, append) + div(class='balance', data-show-send-modal, data-amount='$ctrl.totalSendable', data-ng-class='{"has-send-modal": $ctrl.totalSendable > 0}') + lsk.balance.value(amount='$ctrl.account.get().balance', nocolor, append) + md-tooltip(md-direction='top', md-delay='350', data-ng-if='$ctrl.account.get().balance > 0') Send all funds From bfbe613677210cca60620812b71beaba8c0530c9 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Mon, 29 May 2017 12:58:05 +0200 Subject: [PATCH 3/8] Add posibility to send to specific address or for a specific value by clicking on them --- src/components/send/sendModalDirective.js | 4 +++- src/components/transactions/transactions.less | 4 ++++ src/components/transactions/transactions.pug | 15 ++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/send/sendModalDirective.js b/src/components/send/sendModalDirective.js index 0e3de34ac..2bacdce7f 100644 --- a/src/components/send/sendModalDirective.js +++ b/src/components/send/sendModalDirective.js @@ -15,7 +15,9 @@ app.directive('showSendModal', (SendModal) => { */ const ShowSendModalLink = function (scope, element) { element.bind('click', () => { - SendModal.show(scope.recipientId, scope.amount); + if (scope.amount == undefined || scope.amount > 0) { + SendModal.show(scope.recipientId, scope.amount); + } }); }; diff --git a/src/components/transactions/transactions.less b/src/components/transactions/transactions.less index 972a25591..9603a0f25 100644 --- a/src/components/transactions/transactions.less +++ b/src/components/transactions/transactions.less @@ -75,6 +75,10 @@ transactions { } } + .has-send-modal { + cursor: pointer; + } + .expanding-button { color: #555; cursor: pointer; diff --git a/src/components/transactions/transactions.pug b/src/components/transactions/transactions.pug index fd19017ea..258c00a5c 100644 --- a/src/components/transactions/transactions.pug +++ b/src/components/transactions/transactions.pug @@ -11,7 +11,6 @@ md-card.offline-hide th(md-column) Time th(md-column) Transaction ID th(md-column) From / To - th(md-column) Send to this th(md-column) th(md-column) Amount th(md-column) Fee @@ -32,18 +31,20 @@ md-card.offline-hide span.tx(ng-switch-when='6') Send Lisk to Blockchain Application span.tx(ng-switch-when='7') Send Lisk from Blockchain Application span(ng-switch-default) - span(ng-bind='transaction.senderId', ng-if='transaction.senderId !== $ctrl.account.get().address') - span(ng-bind='transaction.recipientId', ng-if='transaction.senderId === $ctrl.account.get().address') - td(md-cell) - i.material-icons.expanding-button(ng-if='transaction.senderId !== $ctrl.account.get().address', data-show-send-modal, data-recipient-id='transaction.senderId') arrow_forward - i.material-icons.expanding-button(ng-if='transaction.senderId === $ctrl.account.get().address', data-show-send-modal, data-recipient-id='transaction.recipientId') arrow_forward + span(ng-bind='transaction.senderId', ng-if='transaction.senderId !== $ctrl.account.get().address', + data-show-send-modal, data-recipient-id='transaction.senderId', class='has-send-modal') + span(ng-bind='transaction.recipientId', ng-if='transaction.senderId === $ctrl.account.get().address', + data-show-send-modal, data-recipient-id='transaction.recipientId', class='has-send-modal') + md-tooltip(md-direction='top', md-delay='350') Send to this recipient td(md-cell) i.material-icons(ng-if='transaction.type === 0 && transaction.senderId === transaction.recipientId') replay i.material-icons.in(ng-if='transaction.senderId !== $ctrl.account.get().address') call_received i.material-icons.out(ng-if='transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address') call_made td(md-cell) - .amount(ng-class='{ neutral:transaction.type === 0 && transaction.senderId === transaction.recipientId, positive: transaction.senderId !== $ctrl.account.get().address, negative: transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address }') + .amount(ng-class='{"has-send-modal": transaction.amount > 0, neutral:transaction.type === 0 && transaction.senderId === transaction.recipientId, positive: transaction.senderId !== $ctrl.account.get().address, negative: transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address }', + data-show-send-modal, data-amount='transaction.amount') lsk.value(amount='transaction.amount') + md-tooltip(md-direction='top', md-delay='350', data-ng-if='transaction.amount > 0') Send {{transaction.amount}} LSK td(md-cell) .fee lsk(amount='transaction.fee') From 523eb88b587ee5a0dd964a6e37308de94be6a9c9 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Mon, 29 May 2017 14:44:58 +0200 Subject: [PATCH 4/8] eslint fixings --- src/components/send/sendModalDirective.js | 2 +- src/components/top/top.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/send/sendModalDirective.js b/src/components/send/sendModalDirective.js index 2bacdce7f..f0e864036 100644 --- a/src/components/send/sendModalDirective.js +++ b/src/components/send/sendModalDirective.js @@ -15,7 +15,7 @@ app.directive('showSendModal', (SendModal) => { */ const ShowSendModalLink = function (scope, element) { element.bind('click', () => { - if (scope.amount == undefined || scope.amount > 0) { + if (scope.amount === undefined || scope.amount > 0) { SendModal.show(scope.recipientId, scope.amount); } }); diff --git a/src/components/top/top.js b/src/components/top/top.js index 27a29382a..d81d7f7a8 100644 --- a/src/components/top/top.js +++ b/src/components/top/top.js @@ -9,12 +9,13 @@ import './top.less'; app.component('top', { template: require('./top.pug')(), controller: class top { - constructor($scope,Peers, Account) { + constructor($scope, Peers, Account) { this.peers = Peers; this.account = Account; $scope.$on('accountChange', () => { - this.totalSendable = this.account.get().balance > 1e7 ? this.account.get().balance - 1e7 : 0; + this.totalSendable = this.account.get().balance > 1e7 ? + this.account.get().balance - 1e7 : 0; }); } }, From e841ec45b9f197991dfb1e04147ead43fc0484d9 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Mon, 29 May 2017 15:22:28 +0200 Subject: [PATCH 5/8] Normalize the value of the lisk in tooltip --- src/components/transactions/transactions.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/transactions/transactions.pug b/src/components/transactions/transactions.pug index 258c00a5c..e27c9f700 100644 --- a/src/components/transactions/transactions.pug +++ b/src/components/transactions/transactions.pug @@ -44,7 +44,7 @@ md-card.offline-hide .amount(ng-class='{"has-send-modal": transaction.amount > 0, neutral:transaction.type === 0 && transaction.senderId === transaction.recipientId, positive: transaction.senderId !== $ctrl.account.get().address, negative: transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address }', data-show-send-modal, data-amount='transaction.amount') lsk.value(amount='transaction.amount') - md-tooltip(md-direction='top', md-delay='350', data-ng-if='transaction.amount > 0') Send {{transaction.amount}} LSK + md-tooltip(md-direction='top', md-delay='350', data-ng-if='transaction.amount > 0') Send {{transaction.amount | lsk}} LSK td(md-cell) .fee lsk(amount='transaction.fee') From 6c8b2ad731a1b444c0cf4644d6a85219e13ef305 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Mon, 29 May 2017 15:57:15 +0200 Subject: [PATCH 6/8] Remove the duplicated balance class name --- src/components/top/top.less | 2 +- src/components/top/top.pug | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/top/top.less b/src/components/top/top.less index 7a9bee9dc..8c9bb3f3b 100644 --- a/src/components/top/top.less +++ b/src/components/top/top.less @@ -43,7 +43,7 @@ top { font-weight: bold; } - .balance { + .balance-wrapper { display: inline-block; line-height: 41px; &.has-send-modal { diff --git a/src/components/top/top.pug b/src/components/top/top.pug index 121788d0c..3ff78ea05 100644 --- a/src/components/top/top.pug +++ b/src/components/top/top.pug @@ -21,6 +21,6 @@ md-content(layout='column', layout-gt-xs='row') md-card.offline-hide(flex-gt-xs=33) md-card-content(layout='column', layout-align='center center') span.md-title.title Balance - div(class='balance', data-show-send-modal, data-amount='$ctrl.totalSendable', data-ng-class='{"has-send-modal": $ctrl.totalSendable > 0}') + div(class='balance-wrapper', data-show-send-modal, data-amount='$ctrl.totalSendable', data-ng-class='{"has-send-modal": $ctrl.totalSendable > 0}') lsk.balance.value(amount='$ctrl.account.get().balance', nocolor, append) md-tooltip(md-direction='top', md-delay='350', data-ng-if='$ctrl.account.get().balance > 0') Send all funds From b399550f540c3a8ffcde78aeeb49bc550744b200 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Tue, 30 May 2017 09:47:40 +0200 Subject: [PATCH 7/8] Repeat the transation on amount clicked --- src/components/transactions/transactions.pug | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/transactions/transactions.pug b/src/components/transactions/transactions.pug index e27c9f700..b8e724f51 100644 --- a/src/components/transactions/transactions.pug +++ b/src/components/transactions/transactions.pug @@ -41,10 +41,15 @@ md-card.offline-hide i.material-icons.in(ng-if='transaction.senderId !== $ctrl.account.get().address') call_received i.material-icons.out(ng-if='transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address') call_made td(md-cell) - .amount(ng-class='{"has-send-modal": transaction.amount > 0, neutral:transaction.type === 0 && transaction.senderId === transaction.recipientId, positive: transaction.senderId !== $ctrl.account.get().address, negative: transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address }', - data-show-send-modal, data-amount='transaction.amount') + .amount(data-ng-if='transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address', + data-ng-class='{"has-send-modal": transaction.amount > 0}', + data-show-send-modal, data-amount='transaction.amount', data-recipient-id='transaction.recipientId', class='negative') + lsk.value(amount='transaction.amount') + md-tooltip(md-direction='top', md-delay='350', data-ng-if='transaction.amount > 0') Repeat the transaction + .amount(data-ng-if='transaction.senderId !== $ctrl.account.get().address', class='positive') + lsk.value(amount='transaction.amount') + .amount(ng-if='transaction.type === 0 && transaction.senderId === transaction.recipientId', class='neutral') lsk.value(amount='transaction.amount') - md-tooltip(md-direction='top', md-delay='350', data-ng-if='transaction.amount > 0') Send {{transaction.amount | lsk}} LSK td(md-cell) .fee lsk(amount='transaction.fee') From 26956b7f88b83061189554845d934e1f2f552cf9 Mon Sep 17 00:00:00 2001 From: alihaghighatkhah Date: Tue, 30 May 2017 10:00:35 +0200 Subject: [PATCH 8/8] Changing class name --- src/components/transactions/transactions.pug | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/transactions/transactions.pug b/src/components/transactions/transactions.pug index b8e724f51..74dbb5e07 100644 --- a/src/components/transactions/transactions.pug +++ b/src/components/transactions/transactions.pug @@ -41,14 +41,14 @@ md-card.offline-hide i.material-icons.in(ng-if='transaction.senderId !== $ctrl.account.get().address') call_received i.material-icons.out(ng-if='transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address') call_made td(md-cell) - .amount(data-ng-if='transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address', + .amount.negative(data-ng-if='transaction.type !== 0 || transaction.recipientId !== $ctrl.account.get().address', data-ng-class='{"has-send-modal": transaction.amount > 0}', - data-show-send-modal, data-amount='transaction.amount', data-recipient-id='transaction.recipientId', class='negative') + data-show-send-modal, data-amount='transaction.amount', data-recipient-id='transaction.recipientId') lsk.value(amount='transaction.amount') md-tooltip(md-direction='top', md-delay='350', data-ng-if='transaction.amount > 0') Repeat the transaction - .amount(data-ng-if='transaction.senderId !== $ctrl.account.get().address', class='positive') + .amount.positive(data-ng-if='transaction.senderId !== $ctrl.account.get().address') lsk.value(amount='transaction.amount') - .amount(ng-if='transaction.type === 0 && transaction.senderId === transaction.recipientId', class='neutral') + .amount.neutral(ng-if='transaction.type === 0 && transaction.senderId === transaction.recipientId') lsk.value(amount='transaction.amount') td(md-cell) .fee