From 64aa9445de4567a9f69349a8e5ed75fb7b5f9547 Mon Sep 17 00:00:00 2001 From: Ash Bhimasani <16abhimasani@gmail.com> Date: Fri, 1 Jun 2018 10:30:16 -0400 Subject: [PATCH] added index highlighting on input-output pages --- .../components/transaction/transaction.html | 23 +++++--- app/src/components/transaction/transaction.ts | 8 ++- app/src/pages/input-output/input-output.html | 59 +++++++++++++++++++ .../pages/input-output/input-output.module.ts | 20 +++++++ app/src/pages/input-output/input-output.scss | 3 + app/src/pages/input-output/input-output.ts | 53 +++++++++++++++++ 6 files changed, 155 insertions(+), 11 deletions(-) create mode 100644 app/src/pages/input-output/input-output.html create mode 100644 app/src/pages/input-output/input-output.module.ts create mode 100644 app/src/pages/input-output/input-output.scss create mode 100644 app/src/pages/input-output/input-output.ts diff --git a/app/src/components/transaction/transaction.html b/app/src/components/transaction/transaction.html index e660ea9..100a9ad 100644 --- a/app/src/components/transaction/transaction.html +++ b/app/src/components/transaction/transaction.html @@ -32,14 +32,14 @@ - +
@@ -80,7 +87,7 @@ - +

diff --git a/app/src/components/transaction/transaction.ts b/app/src/components/transaction/transaction.ts index 0218813..c3dd62c 100644 --- a/app/src/components/transaction/transaction.ts +++ b/app/src/components/transaction/transaction.ts @@ -19,6 +19,7 @@ export class TransactionComponent { public expanded: boolean = false; @Input() public tx: any = {}; + @Input() public dr?: string; @Input() public dx?: number; constructor(private navCtrl: NavController, public currency: CurrencyProvider) { @@ -39,15 +40,17 @@ export class TransactionComponent { } public goToInput(txId: string, dxNm: number): void { - this.navCtrl.push('input', { + this.navCtrl.push('input-output', { 'txId': txId, + 'dir': '<', 'dxNm': dxNm }); } public goToOutput(txId: string, dxNm: number): void { - this.navCtrl.push('output', { + this.navCtrl.push('input-output', { 'txId': txId, + 'dir': '>', 'dxNm': dxNm }); } @@ -68,7 +71,6 @@ export class TransactionComponent { public aggregateItems(items: Array): Array { - console.log(this.dx); if (!items) return []; diff --git a/app/src/pages/input-output/input-output.html b/app/src/pages/input-output/input-output.html new file mode 100644 index 0000000..0f559f1 --- /dev/null +++ b/app/src/pages/input-output/input-output.html @@ -0,0 +1,59 @@ + + + + + + +

+ +
+ +
+

Output Transaction | Index #{{ dxNm }}

+

Input Transaction | Index #{{ dxNm }}

+

+ Transaction Hash {{ tx.txid }} +

+

+

Summary

+ + + + Size + + {{ tx.size }} (bytes) + + + + Fee Rate + + {{ (tx.fees / tx.size) * 1E8 | number:'1.0-8' }} sats/byte + + + + Received Time + + {{ tx.time * 1000 | date:'medium' }} + + + + Mined Time + + {{ tx.blocktime * 1000 | date:'medium' }} + + + + Included in Block + + {{ tx.blockhash }} + + + +
+

Details

+ + +
+ + + \ No newline at end of file diff --git a/app/src/pages/input-output/input-output.module.ts b/app/src/pages/input-output/input-output.module.ts new file mode 100644 index 0000000..c8021c1 --- /dev/null +++ b/app/src/pages/input-output/input-output.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { IonicPageModule } from 'ionic-angular'; +import { InputOutputPage } from './input-output'; +import { TransactionComponentModule } from '../../components/transaction/transaction.module'; +import { HeadNavComponentModule } from '../../components/head-nav/head-nav.module'; + +@NgModule({ + declarations: [ + InputOutputPage, + ], + imports: [ + IonicPageModule.forChild(InputOutputPage), + TransactionComponentModule, + HeadNavComponentModule + ], + exports: [ + InputOutputPage + ] +}) +export class InputOutputPageModule {} diff --git a/app/src/pages/input-output/input-output.scss b/app/src/pages/input-output/input-output.scss new file mode 100644 index 0000000..a447548 --- /dev/null +++ b/app/src/pages/input-output/input-output.scss @@ -0,0 +1,3 @@ +page-input-output { + +} diff --git a/app/src/pages/input-output/input-output.ts b/app/src/pages/input-output/input-output.ts new file mode 100644 index 0000000..e7215ff --- /dev/null +++ b/app/src/pages/input-output/input-output.ts @@ -0,0 +1,53 @@ +import { Component } from '@angular/core'; +import { IonicPage, NavController, NavParams } from 'ionic-angular'; +import { Http } from '@angular/http'; +import { ApiProvider } from '../../providers/api/api'; + +/** + * Generated class for the InputOutputPage page. + * + * See http://ionicframework.com/docs/components/#navigation for more info + * on Ionic pages and navigation. + */ +@IonicPage({ + name: 'input-output', + segment: 'tx/:txId/:dir/:dxNm' +}) +@Component({ + selector: 'page-input-output', + templateUrl: 'input-output.html', +}) +export class InputOutputPage { + + public loading: boolean = true; + private txId: string; + public dxNm: number; + public dir: string; + public tx: any = {}; + + constructor(public navCtrl: NavController, public navParams: NavParams, private http: Http, private api: ApiProvider) { + this.txId = navParams.get('txId'); + this.dxNm = Number(navParams.get('dxNm')); + this.dir = navParams.get('dir'); + } + + public ionViewDidLoad(): void { + this.http.get(this.api.apiPrefix + 'tx/' + this.txId).subscribe( + (data) => { + this.tx = JSON.parse(data['_body']); + this.loading = false; + }, + (err) => { + console.log('err is', err); + this.loading = false; + } + ); + } + + public goToBlock(blockHash: string): void { + this.navCtrl.push('block-detail', { + 'blockHash': blockHash + }); + } + +}