shapeshift shows message if no available wallet to send from
This commit is contained in:
parent
edbf48c000
commit
1689470fec
2 changed files with 84 additions and 76 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $interval, profileService, walletService, popupService) {
|
angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $interval, profileService, walletService, popupService, lodash) {
|
||||||
|
|
||||||
var walletsBtc = [];
|
var walletsBtc = [];
|
||||||
var walletsBch = [];
|
var walletsBch = [];
|
||||||
|
|
@ -39,13 +39,15 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
walletsBtc = profileService.getWallets({coin: 'btc'});
|
walletsBtc = profileService.getWallets({coin: 'btc'});
|
||||||
walletsBch = profileService.getWallets({coin: 'bch'});
|
walletsBch = profileService.getWallets({coin: 'bch'});
|
||||||
$scope.fromWallets = walletsBtc.concat(walletsBch);
|
$scope.fromWallets = lodash.filter(walletsBtc.concat(walletsBch), function(w) {
|
||||||
$scope.toWallets = walletsBch;
|
return w.status.balance.availableAmount > 0;
|
||||||
if ($scope.fromWallets.length == 0 || $scope.toWallets.length == 0) return;
|
});
|
||||||
|
if ($scope.fromWallets.length == 0) return;
|
||||||
$scope.onFromWalletSelect($scope.fromWallets[0]);
|
$scope.onFromWalletSelect($scope.fromWallets[0]);
|
||||||
$scope.onToWalletSelect($scope.toWallets[0]);
|
$scope.onToWalletSelect($scope.toWallets[0]);
|
||||||
$scope.singleFromWallet = $scope.fromWallets.length == 1;
|
$scope.singleFromWallet = $scope.fromWallets.length == 1;
|
||||||
$scope.singleToWallet = $scope.toWallets.length == 1;
|
$scope.singleToWallet = $scope.toWallets.length == 1;
|
||||||
|
$scope.fromWalletSelectorTitle = 'From';
|
||||||
$scope.toWalletSelectorTitle = 'To';
|
$scope.toWalletSelectorTitle = 'To';
|
||||||
$scope.showFromWallets = false;
|
$scope.showFromWallets = false;
|
||||||
$scope.showToWallets = false;
|
$scope.showToWallets = false;
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,26 @@
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<shapeshift-coin-trader>
|
<div class="send-header-wrapper shapeshift-banner">
|
||||||
<div class="send-header-wrapper shapeshift-banner">
|
<img class="shapeshift-logo" src="img/shapeshiftlogo.svg"/>
|
||||||
<img class="shapeshift-logo" src="img/shapeshiftlogo.svg"/>
|
</div>
|
||||||
|
<div class="list card ng-hide" ng-show="fromWallets.length == 0">
|
||||||
|
<div class="item item-heading">
|
||||||
|
<span translate>No available wallets to convert from.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<shapeshift-coin-trader class="ng-hide" ng-show="fromWallets.length > 0">
|
||||||
|
<div class="list card">
|
||||||
|
<div class="item item-heading">
|
||||||
|
<span translate><strong>From</strong></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="list card">
|
<div class="item wallet-selector" ng-click="showFromWalletSelector()" ng-if="fromWallet">
|
||||||
<div class="item item-heading">
|
<a ng-if="fromWallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
|
||||||
<span translate><strong>From</strong></span>
|
<i class="icon big-icon-svg" ng-include="'views/includes/fromWalletIcon.html'"></i>
|
||||||
</div>
|
<span>
|
||||||
<div class="item wallet-selector" ng-click="showFromWalletSelector()" ng-if="fromWallet">
|
{{fromWallet.name || fromWallet.id}}
|
||||||
<a ng-if="fromWallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
|
</span>
|
||||||
<i class="icon big-icon-svg" ng-include="'views/includes/fromWalletIcon.html'"></i>
|
<p>
|
||||||
<span>
|
|
||||||
{{fromWallet.name || fromWallet.id}}
|
|
||||||
</span>
|
|
||||||
<p>
|
|
||||||
<span ng-if="!fromWallet.balanceHidden"> {{fromWallet.status.totalBalanceStr}} </span>
|
<span ng-if="!fromWallet.balanceHidden"> {{fromWallet.status.totalBalanceStr}} </span>
|
||||||
|
|
||||||
<span ng-if="fromWallet.balanceHidden" translate>[Balance Hidden]</span>
|
<span ng-if="fromWallet.balanceHidden" translate>[Balance Hidden]</span>
|
||||||
|
|
@ -30,21 +35,21 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="assertive" ng-if="fromWallet.error">{{fromWallet.error}}</span>
|
<span class="assertive" ng-if="fromWallet.error">{{fromWallet.error}}</span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
<i ng-if="!singleFromWallet" class="icon bp-arrow-right"></i>
|
<i ng-if="!singleFromWallet" class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item item-heading">
|
<div class="item item-heading">
|
||||||
<span translate><strong>To</strong></span>
|
<span translate><strong>To</strong></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item wallet-selector" ng-click="showToWalletSelector()" ng-if="toWallet">
|
<div class="item wallet-selector" ng-click="showToWalletSelector()" ng-if="toWallet">
|
||||||
<a ng-if="toWallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
|
<a ng-if="toWallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
|
||||||
<i class="icon big-icon-svg" ng-include="'views/includes/toWalletIcon.html'"></i>
|
<i class="icon big-icon-svg" ng-include="'views/includes/toWalletIcon.html'"></i>
|
||||||
<span>
|
<span>
|
||||||
{{toWallet.name || toWallet.id}}
|
{{toWallet.name || toWallet.id}}
|
||||||
</span>
|
</span>
|
||||||
<p>
|
<p>
|
||||||
<span ng-if="!toWallet.balanceHidden"> {{toWallet.status.totalBalanceStr}} </span>
|
<span ng-if="!toWallet.balanceHidden"> {{toWallet.status.totalBalanceStr}} </span>
|
||||||
|
|
||||||
<span ng-if="toWallet.balanceHidden" translate>[Balance Hidden]</span>
|
<span ng-if="toWallet.balanceHidden" translate>[Balance Hidden]</span>
|
||||||
|
|
@ -53,52 +58,53 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="assertive" ng-if="toWallet.error">{{toWallet.error}}</span>
|
<span class="assertive" ng-if="toWallet.error">{{toWallet.error}}</span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
<i ng-if="!singleToWallet" class="icon bp-arrow-right"></i>
|
<i ng-if="!singleToWallet" class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
<div class="item item-heading">
|
|
||||||
Rate: {{rateString}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="item item-heading">
|
||||||
|
Rate: {{rateString}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<shapeshift-coin-selector
|
<shapeshift-coin-selector
|
||||||
coins="coins"
|
coins="coins"
|
||||||
label="'Return Address'"
|
label="'Return Address'"
|
||||||
get-market-data="getMarketDataIn"
|
get-market-data="getMarketDataIn"
|
||||||
market-data="marketData"
|
market-data="marketData"
|
||||||
selected-coin="fromWallet.coin"
|
selected-coin="fromWallet.coin"
|
||||||
coin-address="fromWalletAddress"
|
coin-address="fromWalletAddress"
|
||||||
amount="amount"
|
amount="amount"
|
||||||
direction="'in'">
|
direction="'in'">
|
||||||
</shapeshift-coin-selector>
|
</shapeshift-coin-selector>
|
||||||
<br/>
|
<br/>
|
||||||
<shapeshift-coin-selector
|
<shapeshift-coin-selector
|
||||||
coins="coins"
|
coins="coins"
|
||||||
label="'Withdrawal Address'"
|
label="'Withdrawal Address'"
|
||||||
get-market-data="getMarketDataOut"
|
get-market-data="getMarketDataOut"
|
||||||
selected-coin="toWallet.coin"
|
selected-coin="toWallet.coin"
|
||||||
coin-address="toWalletAddress"
|
coin-address="toWalletAddress"
|
||||||
direction="'out'">
|
direction="'out'">
|
||||||
</shapeshift-coin-selector>
|
</shapeshift-coin-selector>
|
||||||
<shapeshift-coin-error ssError="ssError"></shapeshift-coin-error>
|
<shapeshift-coin-error ssError="ssError"></shapeshift-coin-error>
|
||||||
<!--<shapeshift-coin-deposit-info deposit-status="DepositStatus" deposit-info="depositInfo"></shapeshift-coin-deposit-info>-->
|
<!--<shapeshift-coin-deposit-info deposit-status="DepositStatus" deposit-info="depositInfo"></shapeshift-coin-deposit-info>-->
|
||||||
<shapeshift-coin-shift-button shift-it="shiftIt" shift-state="ShiftState"></shapeshift-coin-shift-button>
|
<shapeshift-coin-shift-button shift-it="shiftIt" shift-state="ShiftState"></shapeshift-coin-shift-button>
|
||||||
</shapeshift-coin-trader>
|
</shapeshift-coin-trader>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<wallet-selector
|
<wallet-selector
|
||||||
wallet-selector-wallets="fromWallets"
|
wallet-selector-title="fromWalletSelectorTitle"
|
||||||
wallet-selector-selected-wallet="fromWallet"
|
wallet-selector-wallets="fromWallets"
|
||||||
wallet-selector-show="showFromWallets"
|
wallet-selector-selected-wallet="fromWallet"
|
||||||
wallet-selector-on-select="onFromWalletSelect">
|
wallet-selector-show="showFromWallets"
|
||||||
</wallet-selector>
|
wallet-selector-on-select="onFromWalletSelect">
|
||||||
|
</wallet-selector>
|
||||||
|
|
||||||
<wallet-selector
|
<wallet-selector
|
||||||
wallet-selector-title="toWalletSelectorTitle"
|
wallet-selector-title="toWalletSelectorTitle"
|
||||||
wallet-selector-wallets="toWallets"
|
wallet-selector-wallets="toWallets"
|
||||||
wallet-selector-selected-wallet="toWallet"
|
wallet-selector-selected-wallet="toWallet"
|
||||||
wallet-selector-show="showToWallets"
|
wallet-selector-show="showToWallets"
|
||||||
wallet-selector-on-select="onToWalletSelect">
|
wallet-selector-on-select="onToWalletSelect">
|
||||||
</wallet-selector>
|
</wallet-selector>
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue