Bisq module separation.

Transaction view.
Block view.
Blocks list.
This commit is contained in:
softsimon
2020-07-13 15:16:12 +07:00
parent 60e1b9a41e
commit db2e293ce5
25 changed files with 438 additions and 187 deletions

View File

@@ -1,5 +1,5 @@
<div class="container-xl">
<h2 style="float: left;">Latest BSQ Transactions</h2>
<h2 style="float: left;">BSQ Transactions</h2>
<br>
<div class="clearfix"></div>
@@ -14,7 +14,7 @@
<th>Block Time</th>
</thead>
<tbody>
<tr *ngFor="let tx of transactions">
<tr *ngFor="let tx of transactions; trackBy: trackByFn">
<td><a [routerLink]="['/tx/' | relativeUrl, tx.id]" [state]="{ bsqTx: tx }">{{ tx.id | shortenString : 16 }}</a></td>
<td><app-bisq-icon class="mr-1" [txType]="tx.txType"></app-bisq-icon> {{ tx.txTypeDisplayString }}</td>
<td>{{ calculateTotalOutput(tx.outputs) / 100 | number: '1.2-2' }}</td>

View File

@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { BisqTransaction, BisqOutput } from '../../interfaces/bisq.interfaces';
import { BisqTransaction, BisqOutput } from '../bisq.interfaces';
import { Subject } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { ApiService } from 'src/app/services/api.service';
import { BisqApiService } from '../bisq-api.service';
@Component({
selector: 'app-bisq-transactions',
@@ -14,13 +14,13 @@ export class BisqTransactionsComponent implements OnInit {
totalCount: number;
page = 1;
itemsPerPage: number;
contentSpace = window.innerHeight - (200 + 200);
contentSpace = window.innerHeight - (165 + 75);
fiveItemsPxSize = 250;
pageSubject$ = new Subject<number>();
constructor(
private apiService: ApiService,
private bisqApiService: BisqApiService,
) { }
ngOnInit(): void {
@@ -28,7 +28,7 @@ export class BisqTransactionsComponent implements OnInit {
this.pageSubject$
.pipe(
switchMap((page) => this.apiService.listBisqTransactions$((page - 1) * 10, this.itemsPerPage))
switchMap((page) => this.bisqApiService.listTransactions$((page - 1) * 10, this.itemsPerPage))
)
.subscribe((response) => {
this.transactions = response.body;
@@ -47,4 +47,8 @@ export class BisqTransactionsComponent implements OnInit {
calculateTotalOutput(outputs: BisqOutput[]): number {
return outputs.reduce((acc: number, output: BisqOutput) => acc + output.bsqAmount, 0);
}
trackByFn(index: number) {
return index;
}
}