Merge pull request #272 from Bitcoin-com/wallet/sprint/20
Wallet/sprint/20
This commit is contained in:
commit
f93797efc0
3 changed files with 23 additions and 14 deletions
|
|
@ -26,9 +26,14 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function formattedAmountController($scope, $timeout, uxLanguage) {
|
function formattedAmountController($scope, uxLanguage) {
|
||||||
$scope.canShow = false;
|
$scope.vm = {};
|
||||||
|
var vm = $scope.vm;
|
||||||
|
|
||||||
|
vm.currency = '';
|
||||||
|
vm.value = '';
|
||||||
|
|
||||||
|
$scope.canShow = false
|
||||||
$scope.displaySizeEqual = !!$scope.sizeEqual;
|
$scope.displaySizeEqual = !!$scope.sizeEqual;
|
||||||
|
|
||||||
var decimalPlaces = {
|
var decimalPlaces = {
|
||||||
|
|
@ -90,16 +95,19 @@
|
||||||
// During watch, may be changed from having a separate currency value,
|
// During watch, may be changed from having a separate currency value,
|
||||||
// to both being in value. Don't want to use previous currency value.
|
// to both being in value. Don't want to use previous currency value.
|
||||||
// Try to extract currency from value..
|
// Try to extract currency from value..
|
||||||
var currencySplit = $scope.value.split(" ");
|
if (!$scope.currency || $scope.currency.length === 0) {
|
||||||
if (currencySplit.length >= 2 && !$scope.currency) {
|
var currencySplit = $scope.value.split(" ");
|
||||||
$scope.currency = currencySplit[currencySplit.length - 1];
|
if (currencySplit.length >= 2) {
|
||||||
|
vm.currency = currencySplit[currencySplit.length - 1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vm.currency = $scope.currency;
|
||||||
}
|
}
|
||||||
$scope.currency = $scope.currency || '';
|
|
||||||
|
|
||||||
// Redo this when we have proper formatting for low fees
|
// Redo this when we have proper formatting for low fees
|
||||||
if ($scope.value.indexOf("<") === 0) {
|
if ($scope.value.indexOf("<") === 0) {
|
||||||
buildAmount($scope.value, '', '');
|
buildAmount($scope.value, '', '');
|
||||||
$scope.currency = '';
|
vm.currency = '';
|
||||||
$scope.canShow = true;
|
$scope.canShow = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +118,7 @@
|
||||||
var parsed = parseFloat($scope.value);
|
var parsed = parseFloat($scope.value);
|
||||||
var valueFormatted = '';
|
var valueFormatted = '';
|
||||||
var valueProcessing = '';
|
var valueProcessing = '';
|
||||||
switch (getDecimalPlaces($scope.currency)) {
|
switch (getDecimalPlaces(vm.currency)) {
|
||||||
case '0':
|
case '0':
|
||||||
if (isNaN(parsed)) {
|
if (isNaN(parsed)) {
|
||||||
buildAmount('-', '', '');
|
buildAmount('-', '', '');
|
||||||
|
|
@ -157,6 +165,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$scope.canShow = true;
|
$scope.canShow = true;
|
||||||
|
$scope.$apply();
|
||||||
};
|
};
|
||||||
|
|
||||||
function getDecimalPlaces(currency) {
|
function getDecimalPlaces(currency) {
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="!showingPaymentReceived" class="amount">
|
<div ng-show="!showingPaymentReceived" class="amount">
|
||||||
<div ng-show="selectedPriceDisplay=='fiat'">
|
<div ng-show="selectedPriceDisplay=='fiat'">
|
||||||
<span class="size-36">{{amountUnitStr}}</span>
|
<span class="size-36"><formatted-amount value="{{amountUnitStr}}"></formatted-amount></span>
|
||||||
<div class="size-14 amount-alternative">
|
<div class="size-14 amount-alternative">
|
||||||
{{altAmountStr | uppercase}}
|
<formatted-amount value="{{altAmountStr | uppercase}}"></formatted-amount>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="selectedPriceDisplay=='crypto'">
|
<div ng-show="selectedPriceDisplay=='crypto'">
|
||||||
<span class="size-36">{{altAmountStr | uppercase}}</span>
|
<span class="size-36"><formatted-amount value="{{altAmountStr | uppercase}}"></formatted-amount></span>
|
||||||
<div class="size-14 amount-alternative">
|
<div class="size-14 amount-alternative">
|
||||||
{{amountUnitStr}}
|
<formatted-amount value="{{amountUnitStr}}"></formatted-amount>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="formatted-amount"
|
<div class="formatted-amount"
|
||||||
ng-class="{ 'size-equal': displaySizeEqual }" ng-show="canShow">
|
ng-class="{ 'size-equal': displaySizeEqual }" ng-show="canShow">
|
||||||
<span ng-if="start.length > 0" class="start">{{start}}</span><span ng-if="middle.length > 0" class="middle">{{middle}}</span><span ng-if="end.length > 0" class="end">{{end}}</span><span ng-if="currency.length > 0" class="currency">{{currency}}</span>
|
<span ng-if="start.length > 0" class="start">{{start}}</span><span ng-if="middle.length > 0" class="middle">{{middle}}</span><span ng-if="end.length > 0" class="end">{{end}}</span><span ng-if="vm.currency.length > 0" class="currency">{{vm.currency}}</span>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue