From 75fd036ec2812a0d9fdd4401909cab2b823ef330 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Tue, 4 Oct 2022 23:30:14 +0000 Subject: [PATCH] Highlight url input/output in tx diagram & list --- .../transaction/transaction.component.html | 1 + .../transaction/transaction.component.ts | 11 +++++++++-- .../transactions-list.component.html | 2 +- .../transactions-list.component.ts | 2 +- .../tx-bowtie-graph/tx-bowtie-graph.component.html | 14 ++++++++++++++ .../tx-bowtie-graph/tx-bowtie-graph.component.scss | 11 +++++++++++ .../tx-bowtie-graph/tx-bowtie-graph.component.ts | 4 +++- 7 files changed, 40 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index dcd59a1f8..5bd40a557 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -209,6 +209,7 @@ [maxStrands]="graphExpanded ? maxInOut : 24" [network]="network" [tooltip]="true" + [inputIndex]="inputIndex" [outputIndex]="outputIndex" (selectInput)="selectInput($event)" (selectOutput)="selectOutput($event)" > diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 8aa313c81..c64c112b1 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -122,8 +122,15 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { .pipe( switchMap((params: ParamMap) => { const urlMatch = (params.get('id') || '').split(':'); - this.txId = urlMatch[0]; - this.outputIndex = urlMatch[1] === undefined ? null : parseInt(urlMatch[1], 10); + if (urlMatch.length === 2 && urlMatch[1].length === 64) { + this.inputIndex = parseInt(urlMatch[0], 10); + this.outputIndex = null; + this.txId = urlMatch[1]; + } else { + this.txId = urlMatch[0]; + this.outputIndex = urlMatch[1] === undefined ? null : parseInt(urlMatch[1], 10); + this.inputIndex = null; + } this.seoService.setTitle( $localize`:@@bisq.transaction.browser-title:Transaction: ${this.txId}:INTERPOLATION:` ); diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.html b/frontend/src/app/components/transactions-list/transactions-list.component.html index e26740aa5..e53c54a7a 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.html +++ b/frontend/src/app/components/transactions-list/transactions-list.component.html @@ -220,7 +220,7 @@ - + diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index 03c2d59ee..4f3f1cec3 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -104,7 +104,7 @@ export class TransactionsListComponent implements OnInit, OnChanges { if (changes.inputIndex || changes.outputIndex || changes.rowLimit) { this.inputRowLimit = Math.max(this.rowLimit, (this.inputIndex || 0) + 3); this.outputRowLimit = Math.max(this.rowLimit, (this.outputIndex || 0) + 3); - if (this.inputIndex || this.outputIndex) { + if ((this.inputIndex || this.outputIndex) && !changes.transactions) { setTimeout(() => { const assetBoxElements = document.getElementsByClassName('assetBox'); if (assetBoxElements && assetBoxElements[0]) { diff --git a/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.html b/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.html index 3f0143a67..ced3b5f57 100644 --- a/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.html +++ b/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.html @@ -41,6 +41,18 @@ + + + + + + + + + + + + @@ -56,6 +68,7 @@ (); @Output() selectOutput = new EventEmitter(); @@ -378,7 +380,7 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges { const output = this.tx.vout[index]; const outspend = this.outspends[index]; if (output && outspend && outspend.spent && outspend.txid) { - this.router.navigate([this.relativeUrlPipe.transform('/tx'), outspend.txid], { + this.router.navigate([this.relativeUrlPipe.transform('/tx'), outspend.vin + ':' + outspend.txid], { queryParamsHandling: 'merge', fragment: 'flow' });