mirror of https://github.com/BTCPrivate/copay.git
add toFiat pipe
This commit is contained in:
parent
e7ffbe0c33
commit
c55bd2e026
|
@ -67,8 +67,10 @@ import { ChooseFeeLevelPage } from '../pages/choose-fee-level/choose-fee-level';
|
||||||
/* Receive */
|
/* Receive */
|
||||||
import { CustomAmountPage } from '../pages/receive/custom-amount/custom-amount';
|
import { CustomAmountPage } from '../pages/receive/custom-amount/custom-amount';
|
||||||
|
|
||||||
/* Providers */
|
/* Pipes */
|
||||||
|
import { ToFiatPipe } from '../pipes/toFiat';
|
||||||
|
|
||||||
|
/* Providers */
|
||||||
import { AddressBookProvider } from '../providers/address-book/address-book';
|
import { AddressBookProvider } from '../providers/address-book/address-book';
|
||||||
import { AppProvider } from '../providers/app/app';
|
import { AppProvider } from '../providers/app/app';
|
||||||
import { BwcProvider } from '../providers/bwc/bwc';
|
import { BwcProvider } from '../providers/bwc/bwc';
|
||||||
|
@ -196,8 +198,18 @@ let providers: any = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let pipes = [
|
||||||
|
ToFiatPipe,
|
||||||
|
];
|
||||||
|
|
||||||
export function declarationsComponents() {
|
export function declarationsComponents() {
|
||||||
return pages.concat(directives);
|
let declarations = [];
|
||||||
|
|
||||||
|
declarations = declarations.concat(pages);
|
||||||
|
declarations = declarations.concat(directives);
|
||||||
|
declarations = declarations.concat(pipes);
|
||||||
|
|
||||||
|
return declarations;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function entryComponents() {
|
export function entryComponents() {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</ion-icon>
|
</ion-icon>
|
||||||
<div class="action">{{tx.action}}</div>
|
<div class="action">{{tx.action}}</div>
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<div class="amount">{{tx.amount}}</div>
|
<div class="amount">{{amountStr | toFiat : tx.amount : unitCode}}</div>
|
||||||
<div class="date">{{tx.time * 1000 | amTimeAgo}}</div>
|
<div class="date">{{tx.time * 1000 | amTimeAgo}}</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { NavParams } from 'ionic-angular';
|
import { NavParams } from 'ionic-angular';
|
||||||
import { WalletProvider } from '../../providers/wallet/wallet';
|
import { WalletProvider } from '../../providers/wallet/wallet';
|
||||||
|
import { ConfigProvider } from '../../providers/config/config';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'page-wallet-details',
|
selector: 'page-wallet-details',
|
||||||
|
@ -8,13 +9,16 @@ import { WalletProvider } from '../../providers/wallet/wallet';
|
||||||
})
|
})
|
||||||
export class WalletDetailsPage {
|
export class WalletDetailsPage {
|
||||||
public wallet: any;
|
public wallet: any;
|
||||||
|
public unitCode: string;
|
||||||
public alternativeBalanceStr: string;
|
public alternativeBalanceStr: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private navParams: NavParams,
|
private navParams: NavParams,
|
||||||
private walletProvider: WalletProvider,
|
private walletProvider: WalletProvider,
|
||||||
|
private configProvider: ConfigProvider,
|
||||||
) {
|
) {
|
||||||
this.wallet = this.navParams.data.wallet;
|
this.wallet = this.navParams.data.wallet;
|
||||||
|
this.unitCode = this.configProvider.get()['wallet']['settings'].unitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
ionViewDidEnter() {
|
ionViewDidEnter() {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import { TxFormatProvider } from '../providers/tx-format/tx-format';
|
||||||
|
|
||||||
|
@Pipe({ name: 'toFiat' })
|
||||||
|
export class ToFiatPipe implements PipeTransform {
|
||||||
|
constructor(
|
||||||
|
private txFormatProvider: TxFormatProvider
|
||||||
|
) {}
|
||||||
|
transform(value: string, satoshis: number, coin: string): any {
|
||||||
|
return this.txFormatProvider.formatAmountStr(coin, satoshis);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue