Initial implementation for balance modal.
This commit is contained in:
parent
43836a4743
commit
4d3ff6c2f0
9 changed files with 273 additions and 34 deletions
24
src/js/controllers/modals/walletBalance.js
Normal file
24
src/js/controllers/modals/walletBalance.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletBalanceController', function($scope, $timeout, $ionicHistory, gettextCatalog, configService, feeService, ongoingProcess, popupService) {
|
||||
|
||||
ongoingProcess.set('gettingFeeLevels', true);
|
||||
feeService.getFeeLevels(function(err, levels) {
|
||||
ongoingProcess.set('gettingFeeLevels', false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.feeLevels = levels;
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
$scope.close = function() {
|
||||
$scope.walletBalanceModal.hide();
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$scope.feeOpts = feeService.feeOpts;
|
||||
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
|
||||
});
|
||||
});
|
||||
|
|
@ -107,6 +107,15 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openBalanceModal = function() {
|
||||
$ionicModal.fromTemplateUrl('views/modals/wallet-balance.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.walletBalanceModal = modal;
|
||||
$scope.walletBalanceModal.show();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.recreate = function() {
|
||||
walletService.recreate($scope.wallet, function(err) {
|
||||
if (err) return;
|
||||
|
|
@ -252,16 +261,16 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
return;
|
||||
}
|
||||
prevPos = pos;
|
||||
var amountHeight = 180 - pos;
|
||||
var amountHeight = 210 - pos;
|
||||
if (amountHeight < 80) {
|
||||
amountHeight = 80;
|
||||
}
|
||||
var contentMargin = amountHeight;
|
||||
if (contentMargin > 180) {
|
||||
contentMargin = 180;
|
||||
if (contentMargin > 210) {
|
||||
contentMargin = 210;
|
||||
}
|
||||
|
||||
var amountScale = (amountHeight / 180);
|
||||
var amountScale = (amountHeight / 210);
|
||||
if (amountScale < 0.5) {
|
||||
amountScale = 0.5;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,13 +166,15 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
cache.lockedBalanceSat = balance.lockedAmount;
|
||||
cache.availableBalanceSat = balance.availableAmount;
|
||||
cache.totalBytesToSendMax = balance.totalBytesToSendMax;
|
||||
cache.pendingAmount = null;
|
||||
cache.pendingAmount = 0;
|
||||
cache.spendableAmount = balance.totalAmount - balance.lockedAmount;
|
||||
} else {
|
||||
cache.totalBalanceSat = balance.totalConfirmedAmount;
|
||||
cache.lockedBalanceSat = balance.lockedConfirmedAmount;
|
||||
cache.availableBalanceSat = balance.availableConfirmedAmount;
|
||||
cache.totalBytesToSendMax = balance.totalBytesToSendConfirmedMax;
|
||||
cache.pendingAmount = balance.totalAmount - balance.totalConfirmedAmount;
|
||||
cache.spendableAmount = balance.totalConfirmedAmount - balance.lockedAmount;
|
||||
}
|
||||
|
||||
// Selected unit
|
||||
|
|
@ -184,13 +186,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
cache.totalBalanceStr = txFormatService.formatAmount(cache.totalBalanceSat) + ' ' + cache.unitName;
|
||||
cache.lockedBalanceStr = txFormatService.formatAmount(cache.lockedBalanceSat) + ' ' + cache.unitName;
|
||||
cache.availableBalanceStr = txFormatService.formatAmount(cache.availableBalanceSat) + ' ' + cache.unitName;
|
||||
cache.pendingBalanceStr = txFormatService.formatAmount(cache.totalBalanceSat + (cache.pendingAmount === null ? 0 : cache.pendingAmount)) + ' ' + cache.unitName;
|
||||
|
||||
if (cache.pendingAmount !== null && cache.pendingAmount !== 0) {
|
||||
cache.pendingAmountStr = txFormatService.formatAmount(cache.pendingAmount) + ' ' + cache.unitName;
|
||||
} else {
|
||||
cache.pendingAmountStr = null;
|
||||
}
|
||||
cache.spendableBalanceStr = txFormatService.formatAmount(cache.spendableAmount) + ' ' + cache.unitName;
|
||||
cache.pendingBalanceStr = txFormatService.formatAmount(cache.pendingAmount) + ' ' + cache.unitName;
|
||||
|
||||
cache.alternativeName = config.settings.alternativeName;
|
||||
cache.alternativeIsoCode = config.settings.alternativeIsoCode;
|
||||
|
|
@ -209,11 +206,15 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
rateService.whenAvailable(function() {
|
||||
|
||||
var totalBalanceAlternative = rateService.toFiat(cache.totalBalanceSat, cache.alternativeIsoCode);
|
||||
var pendingBalanceAlternative = rateService.toFiat(cache.pendingAmount, cache.alternativeIsoCode);
|
||||
var lockedBalanceAlternative = rateService.toFiat(cache.lockedBalanceSat, cache.alternativeIsoCode);
|
||||
var spendableBalanceAlternative = rateService.toFiat(cache.spendableAmount, cache.alternativeIsoCode);
|
||||
var alternativeConversionRate = rateService.toFiat(100000000, cache.alternativeIsoCode);
|
||||
|
||||
cache.totalBalanceAlternative = $filter('formatFiatAmount')(totalBalanceAlternative);
|
||||
cache.pendingBalanceAlternative = $filter('formatFiatAmount')(pendingBalanceAlternative);
|
||||
cache.lockedBalanceAlternative = $filter('formatFiatAmount')(lockedBalanceAlternative);
|
||||
cache.spendableBalanceAlternative = $filter('formatFiatAmount')(spendableBalanceAlternative);
|
||||
cache.alternativeConversionRate = $filter('formatFiatAmount')(alternativeConversionRate);
|
||||
|
||||
cache.alternativeBalanceAvailable = true;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
@import "tab-scan";
|
||||
@import "tab-send";
|
||||
@import "tab-settings";
|
||||
@import "walletBalance";
|
||||
@import "walletDetails";
|
||||
@import "advancedSettings";
|
||||
@import "bitpayCard";
|
||||
|
|
|
|||
94
src/sass/views/walletBalance.scss
Normal file
94
src/sass/views/walletBalance.scss
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
.wallet-balance {
|
||||
|
||||
&__amount {
|
||||
|
||||
font-size: 16px;
|
||||
|
||||
&--available {
|
||||
color: $mid-gray;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&--confirming {
|
||||
color: #09C286;
|
||||
}
|
||||
|
||||
&--locked {
|
||||
color: $dark-gray;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&__title {
|
||||
flex-grow: 1;
|
||||
color: $dark-gray;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
float: left;
|
||||
margin-right: 1rem;
|
||||
color: $light-gray;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
&__list {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
||||
&__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
padding: 0.6rem 0;
|
||||
padding-right: 1rem;
|
||||
border-bottom: 1px solid rgb(245, 245, 245);
|
||||
overflow: hidden;
|
||||
|
||||
&.no-border {
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__amount {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__heading {
|
||||
font-size: 17px;
|
||||
color: #445;
|
||||
margin: 1rem 1rem 0 1rem;
|
||||
}
|
||||
|
||||
&__description {
|
||||
font-size: 15px;
|
||||
color: #667;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#wallet-balance {
|
||||
|
||||
ion-content {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -168,9 +168,9 @@
|
|||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
height: 180px;
|
||||
height: 210px;
|
||||
padding-top: 40px;
|
||||
display: flex;
|
||||
display: block;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
|
|
@ -195,6 +195,15 @@
|
|||
strong {
|
||||
line-height: 100%;
|
||||
}
|
||||
|
||||
&__top {
|
||||
margin-top: 45px;
|
||||
}
|
||||
|
||||
&__button-balance {
|
||||
background-color: transparent;
|
||||
border: 1px solid rgba(255,255,255,0.25);
|
||||
}
|
||||
}
|
||||
.item.item-footer {
|
||||
font-weight: lighter;
|
||||
|
|
@ -214,7 +223,7 @@
|
|||
position: absolute;
|
||||
top: inherit;
|
||||
left: 10px;
|
||||
bottom: 15px;
|
||||
bottom: 5px;
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue