added address page

This commit is contained in:
Darren Nelsen 2017-07-31 15:38:47 -04:00
parent 583139ca2c
commit 07d7fb3537
6 changed files with 93 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<div>
<div *ngFor="let tx of transactions.txs" style="border: 1px solid purple">
<p>{{ tx.txid }}</p>
<p><a (click)="goToTx(tx.txid)">{{ tx.txid }}</a></p>
<div [hidden]="!tx.firstSeenTs">
<span translate>first seen at</span>
<time>{{tx.firstSeenTs * 1000 | date:'medium'}}</time>
@ -23,14 +23,14 @@
<div *ngFor="let vout of tx.vout">
<div>
<p>{{ getAddress(vout) }} {{ vout.value + ' BTC' }} <span [hidden]="!vout.spentTxId">(S)</span><span [hidden]="vout.spentTxId">(U)</span></p>
<p><a (click)="goToAddress(getAddress(vout))">{{ getAddress(vout) }}</a> {{ vout.value + ' BTC' }} <span [hidden]="!vout.spentTxId">(S)</span><span [hidden]="vout.spentTxId">(U)</span></p>
</div>
</div>
</div>
<div [hidden]="tx.isCoinBase">
<div *ngFor="let vin of tx.vin">
<div>{{ vin.addr }}</div>
<div><a (click)="goToAddress(vin.addr)">{{ vin.addr }}</a></div>
<p>{{ vin.value + ' BTC' }}</p>
</div>
@ -40,7 +40,7 @@
<div *ngFor="let vout of tx.vout">
<div>
<p>{{ getAddress(vout) }} {{ vout.value + ' BTC' }} <span [hidden]="!vout.spentTxId">(S)</span><span [hidden]="vout.spentTxId">(U)</span></p>
<p><a (click)="goToAddress(getAddress(vout))">{{ getAddress(vout) }}</a> {{ vout.value + ' BTC' }} <span [hidden]="!vout.spentTxId">(S)</span><span [hidden]="vout.spentTxId">(U)</span></p>
</div>
</div>
</div>

View File

@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { Input } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Http } from '@angular/http';
/**
@ -18,7 +19,7 @@ export class TransactionsComponent {
@Input() public blockHash: string;
public transactions: any = [];
constructor(private http: Http) {
constructor(private navCtrl: NavController, private http: Http) {
}
private ngOnInit(): void {
@ -47,4 +48,20 @@ export class TransactionsComponent {
return 'Unparsed address';
}
}
public goToTx(txId: string): void {
console.log('tx', txId);
/*
this.navCtrl.push('tx', {
'tx': txId
});
*/
}
public goToAddress(address: string): void {
console.log('address', address);
this.navCtrl.push('address', {
'address': address
});
}
}

View File

@ -0,0 +1,25 @@
<!--
Generated template for the AddressPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<ion-title>Address</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<h1>Address</h1>
<h2>Summary</h2>
<div>
<p>Total Received:</p>
<p>Total Sent:</p>
<p>Final Balance:</p>
<p>No. Transactions:</p>
</div>
</ion-content>

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { AddressPage } from './address';
@NgModule({
declarations: [
AddressPage
],
imports: [
IonicPageModule.forChild(AddressPage)
],
exports: [
AddressPage
]
})
export class AddressPageModule {}

View File

@ -0,0 +1,3 @@
page-address {
}

View File

@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
/**
* Generated class for the AddressPage page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
@IonicPage({
name: 'address',
segment: 'address/:address'
})
@Component({
selector: 'page-address',
templateUrl: 'address.html'
})
export class AddressPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
public ionViewDidLoad(): void {
console.log('ionViewDidLoad AddressPage');
}
}