Commit e10d0e5f authored by dev0tion's avatar dev0tion

Seperate coin notation from coin abbreviation

parent 74d1abc2
...@@ -13,46 +13,46 @@ export class CoinNotationPipe implements PipeTransform { ...@@ -13,46 +13,46 @@ export class CoinNotationPipe implements PipeTransform {
private coinNotation: number; private coinNotation: number;
private decimalLimit = 8; private decimalLimit = 8;
transform(value: any): any { transform(value: number): number {
let temp; let temp;
if (typeof value === 'number') { if (typeof value === 'number') {
switch (this.getCoinUnit()) { switch (this.getCoinUnit()) {
case "BTC": case "BTC":
temp = value / 100000000; temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " BTC"; return temp.toFixed(this.decimalLimit);
case "mBTC": case "mBTC":
temp = value / 100000; temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " mBTC"; return temp.toFixed(this.decimalLimit);
case "uBTC": case "uBTC":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " uBTC"; return temp.toFixed(this.decimalLimit);
case "TBTC": case "TBTC":
temp = value / 100000000; temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TBTC"; return temp.toFixed(this.decimalLimit);
case "TmBTC": case "TmBTC":
temp = value / 100000; temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmBTC"; return temp.toFixed(this.decimalLimit);
case "TuBTC": case "TuBTC":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " TuBTC"; return temp.toFixed(this.decimalLimit);
case "STRAT": case "STRAT":
temp = value / 100000000; temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " STRAT"; return temp.toFixed(this.decimalLimit);
case "mSTRAT": case "mSTRAT":
temp = value / 100000; temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " mSTRAT"; return temp.toFixed(this.decimalLimit);
case "uSTRAT": case "uSTRAT":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " uSTRAT"; return temp.toFixed(this.decimalLimit);
case "TSTRAT": case "TSTRAT":
temp = value / 100000000; temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TSTRAT"; return temp.toFixed(this.decimalLimit);
case "TmSTRAT": case "TmSTRAT":
temp = value / 100000; temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmSTRAT"; return temp.toFixed(this.decimalLimit);
case "TuSTRAT": case "TuSTRAT":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " TuSTRAT"; return temp.toFixed(this.decimalLimit);
} }
} }
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<p class="lead"> <p class="lead">
<!--<strong><span class="h2">29</span>.76500293</strong>--> <!--<strong><span class="h2">29</span>.76500293</strong>-->
<strong>{{ confirmedBalance | coinNotation }}</strong> <strong>{{ confirmedBalance | coinNotation }}</strong>
<!--<small class="text-uppercase">btc</small>--> <small class="text-uppercase"> {{ coinUnit }}</small>
</p> </p>
</div> </div>
<!-- /col--> <!-- /col-->
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<h5>Unconfirmed balance</h5> <h5>Unconfirmed balance</h5>
<p class="lead"> <p class="lead">
<strong>{{ unconfirmedBalance | coinNotation }}</strong> <strong>{{ unconfirmedBalance | coinNotation }}</strong>
<small class="text-uppercase"> {{ coinUnit }}</small>
</p> </p>
</div> </div>
<!-- /col--> <!-- /col-->
...@@ -56,7 +57,7 @@ ...@@ -56,7 +57,7 @@
<span *ngIf="transaction.transactionType == 'received'" class="text-success">+</span> <span *ngIf="transaction.transactionType == 'received'" class="text-success">+</span>
<span *ngIf="transaction.transactionType == 'sent'" class="text-danger">-</span> <span *ngIf="transaction.transactionType == 'sent'" class="text-danger">-</span>
{{ transaction.transactionAmount | coinNotation }} {{ transaction.transactionAmount | coinNotation }}
<!--<small class="text-uppercase">btc</small>--> <small class="text-uppercase">{{ coinUnit }}</small>
<span *ngIf="transaction.transactionConfirmedInBlock" class="badge badge-success text-capitalize">Confirmed</span> <span *ngIf="transaction.transactionConfirmedInBlock" class="badge badge-success text-capitalize">Confirmed</span>
<span *ngIf="!transaction.transactionConfirmedInBlock" class="badge badge-warning text-capitalize">Pending</span> <span *ngIf="!transaction.transactionConfirmedInBlock" class="badge badge-warning text-capitalize">Pending</span>
</li> </li>
......
...@@ -25,11 +25,13 @@ export class DashboardComponent implements OnInit { ...@@ -25,11 +25,13 @@ export class DashboardComponent implements OnInit {
public confirmedBalance: number; public confirmedBalance: number;
public unconfirmedBalance: number; public unconfirmedBalance: number;
public transactionArray: TransactionInfo[]; public transactionArray: TransactionInfo[];
public coinUnit: string;
private walletBalanceSubscription: Subscription; private walletBalanceSubscription: Subscription;
private walletHistorySubscription: Subscription; private walletHistorySubscription: Subscription;
ngOnInit() { ngOnInit() {
this.startSubscriptions(); this.startSubscriptions();
this.coinUnit = this.globalService.getCoinUnit();
}; };
ngOnDestroy() { ngOnDestroy() {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<span *ngIf="transaction.transactionType == 'received'" class="text-success">+</span> <span *ngIf="transaction.transactionType == 'received'" class="text-success">+</span>
<span *ngIf="transaction.transactionType == 'sent'" class="text-danger">-</span> <span *ngIf="transaction.transactionType == 'sent'" class="text-danger">-</span>
{{ transaction.transactionAmount | coinNotation }} {{ transaction.transactionAmount | coinNotation }}
<!--<small class="text-uppercase">btc</small>--> <small class="text-uppercase"> {{ coinUnit }} </small>
<span *ngIf="transaction.transactionConfirmedInBlock" class="badge badge-success text-capitalize">Confirmed</span> <span *ngIf="transaction.transactionConfirmedInBlock" class="badge badge-success text-capitalize">Confirmed</span>
<span *ngIf="!transaction.transactionConfirmedInBlock" class="badge badge-warning text-capitalize">Pending</span> <span *ngIf="!transaction.transactionConfirmedInBlock" class="badge badge-warning text-capitalize">Pending</span>
</li> </li>
......
...@@ -22,11 +22,13 @@ export class HistoryComponent { ...@@ -22,11 +22,13 @@ export class HistoryComponent {
constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal) {} constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal) {}
public transactions: TransactionInfo[]; public transactions: TransactionInfo[];
public coinUnit: string;
private errorMessage: string; private errorMessage: string;
private walletHistorySubscription: Subscription; private walletHistorySubscription: Subscription;
ngOnInit() { ngOnInit() {
this.startSubscriptions(); this.startSubscriptions();
this.coinUnit = this.globalService.getCoinUnit();
} }
ngOnDestroy() { ngOnDestroy() {
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
</ul> </ul>
<ul class="list-inline row"> <ul class="list-inline row">
<li class="list-inline-item col blockLabel">Amount</li> <li class="list-inline-item col blockLabel">Amount</li>
<li *ngIf="transaction.transactionType == 'received'" class="list-inline-item col-9 blockText text-success">{{ transaction.transactionAmount | coinNotation }}</li> <li *ngIf="transaction.transactionType == 'received'" class="list-inline-item col-9 blockText text-success">{{ transaction.transactionAmount | coinNotation }} {{ coinUnit }}</li>
<li *ngIf="transaction.transactionType == 'sent'" class="list-inline-item col-9 blockText text-danger">-{{ transaction.transactionAmount | coinNotation }}</li> <li *ngIf="transaction.transactionType == 'sent'" class="list-inline-item col-9 blockText text-danger">-{{ transaction.transactionAmount | coinNotation }} {{ coinUnit }}</li>
</ul> </ul>
<ul class="list-inline row"> <ul class="list-inline row">
<li *ngIf="transaction.transactionType == 'received'" class="list-inline-item col blockLabel">From</li> <li *ngIf="transaction.transactionType == 'received'" class="list-inline-item col blockLabel">From</li>
......
...@@ -18,12 +18,14 @@ export class TransactionDetailsComponent implements OnInit, OnDestroy { ...@@ -18,12 +18,14 @@ export class TransactionDetailsComponent implements OnInit, OnDestroy {
constructor(private apiService: ApiService, private globalService: GlobalService, public activeModal: NgbActiveModal) {} constructor(private apiService: ApiService, private globalService: GlobalService, public activeModal: NgbActiveModal) {}
public copied: boolean = false; public copied: boolean = false;
public coinUnit: string;
private generalWalletInfoSubscription: Subscription; private generalWalletInfoSubscription: Subscription;
private lastBlockSyncedHeight: number; private lastBlockSyncedHeight: number;
private confirmations: number; private confirmations: number;
ngOnInit() { ngOnInit() {
this.startSubscriptions(); this.startSubscriptions();
this.coinUnit = this.globalService.getCoinUnit();
} }
ngOnDestroy() { ngOnDestroy() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment