diff --git a/app/package.json b/app/package.json index bb7407e..00d8da9 100644 --- a/app/package.json +++ b/app/package.json @@ -38,12 +38,10 @@ "devDependencies": { "@angular/cli": "1.1.2", "@ionic/app-scripts": "1.3.7", - "@ionic/cli-plugin-cordova": "1.6.2", - "@ionic/cli-plugin-ionic-angular": "1.4.1", "@types/jasmine": "2.5.41", "@types/node": "7.0.4", "codecov": "2.2.0", - "ionic": "3.9.1", + "ionic": "3.9.2", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "3.2.0", "karma": "1.4.1", diff --git a/app/src/components/latest-transactions/latest-transactions.html b/app/src/components/latest-transactions/latest-transactions.html index 948536e..55e5084 100644 --- a/app/src/components/latest-transactions/latest-transactions.html +++ b/app/src/components/latest-transactions/latest-transactions.html @@ -1,4 +1,27 @@ -
- {{text}} +
+ +
+ +
+ + + + Hash + Value Out + + + + + + + + {{ currency.getConversion(tx.valueOut) }} + + + + +
diff --git a/app/src/components/latest-transactions/latest-transactions.scss b/app/src/components/latest-transactions/latest-transactions.scss index 570ea96..1b68322 100644 --- a/app/src/components/latest-transactions/latest-transactions.scss +++ b/app/src/components/latest-transactions/latest-transactions.scss @@ -1,3 +1,23 @@ latest-transactions { + ion-grid { + // border: 2px solid green; + margin: 10px 0 20px; + ion-row { + border-top: 1px solid #ccc; + } + + ion-row:nth-child(even) { + background-color: #f4f4f4; + } + + ion-row:first-child { + background-color: white; + border-top: none; + } + + ion-row:last-child { + background-color: white; + } + } } diff --git a/app/src/components/latest-transactions/latest-transactions.ts b/app/src/components/latest-transactions/latest-transactions.ts index 4650fff..5facbe4 100644 --- a/app/src/components/latest-transactions/latest-transactions.ts +++ b/app/src/components/latest-transactions/latest-transactions.ts @@ -1,6 +1,8 @@ -import { Component } from '@angular/core'; -// import { Http } from '@angular/http'; -// import { ApiProvider } from '../../providers/api/api'; +import { Component, NgZone, Input } from '@angular/core'; +import { Http } from '@angular/http'; +import { NavController } from 'ionic-angular'; +import { ApiProvider } from '../../providers/api/api'; +import { CurrencyProvider } from '../../providers/currency/currency'; /** * Generated class for the LatestTransactionsComponent component. @@ -14,14 +16,34 @@ import { Component } from '@angular/core'; }) export class LatestTransactionsComponent { - private text: string; + private loading: boolean = true; + private transactions: Array = []; + @Input() public refreshSeconds: number = 10; + private timer: number; - constructor(/*private http: Http, private api: ApiProvider*/) { - console.log('Hello LatestTransactionsComponent Component'); - this.text = 'Hello Latest Transactions'; + constructor(private http: Http, private navCtrl: NavController, private api: ApiProvider, public currency: CurrencyProvider, private ngZone: NgZone) { + this.loadTransactions(); + } - /* - let url: string = this.api.apiPrefix + 'txs?' + this.queryType + '=' + this.queryValue; + public ngOnChanges(): void { + if (this.timer) { + clearInterval(this.timer); + } + + this.ngZone.runOutsideAngular(() => { + this.timer = setInterval( + function (): void { + this.ngZone.run(function (): void { + this.loadTransactions.call(this); + }.bind(this)); + }.bind(this), + 1000 * this.refreshSeconds + ); + }); + } + + private loadTransactions(): void { + let url: string = this.api.apiPrefix + 'txs'; this.http.get(url).subscribe( (data) => { @@ -33,20 +55,11 @@ export class LatestTransactionsComponent { this.loading = false; } ); - */ - - /* - 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 goToTx(txId: string): void { + this.navCtrl.push('transaction', { + 'txId': txId + }); + } } diff --git a/app/src/pages/home/home.html b/app/src/pages/home/home.html index ad57d6d..2449c40 100644 --- a/app/src/pages/home/home.html +++ b/app/src/pages/home/home.html @@ -18,7 +18,7 @@

Latest Transactions

- +
diff --git a/app/src/pages/home/home.ts b/app/src/pages/home/home.ts index 5880022..c556b4f 100644 --- a/app/src/pages/home/home.ts +++ b/app/src/pages/home/home.ts @@ -20,8 +20,4 @@ export class HomePage { constructor(public navCtrl: NavController, public navParams: NavParams) { } - public ionViewDidLoad(): void { - console.log('ionViewDidLoad HomePage'); - } - } diff --git a/app/src/providers/blocks/blocks.ts b/app/src/providers/blocks/blocks.ts index 6ab163c..bdccdd1 100644 --- a/app/src/providers/blocks/blocks.ts +++ b/app/src/providers/blocks/blocks.ts @@ -13,7 +13,6 @@ import { ApiProvider } from '../../providers/api/api'; export class BlocksProvider { constructor(public http: Http, private api: ApiProvider) { - console.log('Hello BlocksProvider Provider'); } public getBlocks(): any { diff --git a/app/yarn.lock b/app/yarn.lock index 575bfc5..f01060f 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -159,50 +159,9 @@ ws "1.1.1" xml2js "^0.4.17" -"@ionic/cli-plugin-cordova@1.6.2": - version "1.6.2" - resolved "https://registry.yarnpkg.com/@ionic/cli-plugin-cordova/-/cli-plugin-cordova-1.6.2.tgz#f71d10641df8b522f54f8274e0d5bc4dbb8b5208" - dependencies: - "@ionic/cli-utils" "1.7.0" - chalk "^2.0.0" - elementtree "^0.1.7" - tslib "^1.7.1" - -"@ionic/cli-plugin-ionic-angular@1.4.1": - version "1.4.1" - resolved "https://registry.yarnpkg.com/@ionic/cli-plugin-ionic-angular/-/cli-plugin-ionic-angular-1.4.1.tgz#bb94b7ad61c2f79757b2dff041c0b7e2151777ec" - dependencies: - "@ionic/cli-utils" "1.7.0" - chalk "^2.0.0" - tslib "^1.7.1" - -"@ionic/cli-utils@1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@ionic/cli-utils/-/cli-utils-1.7.0.tgz#05bdbf3e7533eeeee27d58f3adbfe26bf2bf0d1d" - dependencies: - archiver "^2.0.0" - chalk "^2.0.0" - ci-info "^1.0.0" - cross-spawn "^5.1.0" - dargs "^5.1.0" - dev-null "^0.1.1" - inquirer "^3.2.1" - leek "0.0.24" - lodash "^4.17.4" - minimist "^1.2.0" - ncp "^2.0.0" - semver "^5.4.1" - slice-ansi "^1.0.0" - string-width "^2.1.1" - strip-ansi "^4.0.0" - superagent "^3.5.2" - tslib "^1.7.1" - uuid "^3.0.1" - wrap-ansi "^3.0.1" - -"@ionic/cli-utils@1.9.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@ionic/cli-utils/-/cli-utils-1.9.1.tgz#a0118819cb8de1f3bc4bc5b401e5b61d7f41d5b5" +"@ionic/cli-utils@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@ionic/cli-utils/-/cli-utils-1.9.2.tgz#9916d8bb6ec696b948b6be1c05fbec46c87ddc0b" dependencies: "@types/gulp" "^3.8.33" archiver "^2.0.0" @@ -1973,10 +1932,6 @@ detect-node@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.3.tgz#a2033c09cc8e158d37748fbde7507832bd6ce127" -dev-null@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dev-null/-/dev-null-0.1.1.tgz#5a205ce3c2b2ef77b6238d6ba179eb74c6a0e818" - di@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" @@ -3223,11 +3178,11 @@ ionic-angular@3.4.2: version "3.4.2" resolved "https://registry.yarnpkg.com/ionic-angular/-/ionic-angular-3.4.2.tgz#762631f1af78a5ae1c0aa0f4d23b31435142abe1" -ionic@3.9.1: - version "3.9.1" - resolved "https://registry.yarnpkg.com/ionic/-/ionic-3.9.1.tgz#be50eea2f55bad40574772ecaeaf5a460fd16330" +ionic@3.9.2: + version "3.9.2" + resolved "https://registry.yarnpkg.com/ionic/-/ionic-3.9.2.tgz#d958069ce29d9dbb8b9c1638b59995ce005ce845" dependencies: - "@ionic/cli-utils" "1.9.1" + "@ionic/cli-utils" "1.9.2" chalk "^2.0.0" opn "^5.1.0" os-name "^2.0.1"