remove logic from view - add translates and styles

This commit is contained in:
JDonadio 2017-11-01 15:07:00 -03:00
parent a036c6d192
commit 7a08ad45b1
No known key found for this signature in database
GPG Key ID: EC1F4E04B2BFA730
3 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>Home</ion-title> <ion-title translate>Home</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
@ -26,9 +26,10 @@
<ion-icon item-start> <ion-icon item-start>
<img src="assets/img/icon-wallet.svg" class="icon-wallet"> <img src="assets/img/icon-wallet.svg" class="icon-wallet">
</ion-icon> </ion-icon>
<h2>{{wallet.credentials.walletName}} {{wallet.credentials.m}}-{{wallet.credentials.n}}</h2> <h2>{{wallet.credentials.walletName}} <span *ngIf="wallet.credentials.m > 1">{{wallet.credentials.m}}-{{wallet.credentials.n}}</span></h2>
<p *ngIf="!wallet.scanning">{{wallet.status.totalBalanceStr ? wallet.status.totalBalanceStr : ( wallet.cachedBalance ? wallet.cachedBalance + (wallet.cachedBalanceUpdatedOn ? ' &middot; ' + ( wallet.cachedBalanceUpdatedOn * 1000 | amTimeAgo) : '') : '' )}}</p> <span *ngIf="wallet.scanning" translate>Scanning funds</span>
<span *ngIf="wallet.scanning"> Scanning funds... </span> <p *ngIf="!wallet.scanning">{{wallet.statusStr}}</p>
<p *ngIf="wallet.error" class="error">{{wallet.error}}</p>
</button> </button>
</ion-list> </ion-list>
</ion-card> </ion-card>

View File

@ -11,3 +11,7 @@ img {
margin: 0 !important; margin: 0 !important;
padding: 10px !important; padding: 10px !important;
} }
.error {
color: color($colors, danger) !important;
}

View File

@ -6,6 +6,7 @@ import { ReleaseProvider } from '../../providers/release/release';
import { WalletProvider } from '../../providers/wallet/wallet'; import { WalletProvider } from '../../providers/wallet/wallet';
import { BwcErrorProvider } from '../../providers/bwc-error/bwc-error'; import { BwcErrorProvider } from '../../providers/bwc-error/bwc-error';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as moment from 'moment';
@Component({ @Component({
selector: 'page-home', selector: 'page-home',
@ -33,6 +34,10 @@ export class HomePage {
private updateAllWallets(): void { private updateAllWallets(): void {
_.each(this.wallets, (wallet: any) => { _.each(this.wallets, (wallet: any) => {
this.walletProvider.getStatus(wallet, {}).then((status: any) => { this.walletProvider.getStatus(wallet, {}).then((status: any) => {
const balanceStr = status.totalBalanceStr ? wallet.status.totalBalanceStr : '';
const cachedBalanceStr = wallet.cachedBalance ? wallet.cachedBalance : '';
const cachedBalanceUpdateOn = wallet.cachedBalanceUpdatedOn ? ' - ' + moment(wallet.cachedBalanceUpdatedOn * 1000).fromNow() : '';
wallet.statusStr = balanceStr || cachedBalanceStr + cachedBalanceUpdateOn;
wallet.status = status; wallet.status = status;
this.profileProvider.setLastKnownBalance(wallet.id, wallet.status.totalBalanceStr); this.profileProvider.setLastKnownBalance(wallet.id, wallet.status.totalBalanceStr);
}).catch((err) => { }).catch((err) => {