Merge branch 'master' into simon/improved-warning-message

This commit is contained in:
softsimon 2023-04-03 20:03:04 +09:00 committed by GitHub
commit d59a31a65a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 11 deletions

View file

@ -23,7 +23,7 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On
@Input() unavailable: boolean = false; @Input() unavailable: boolean = false;
@Input() auditHighlighting: boolean = false; @Input() auditHighlighting: boolean = false;
@Input() blockConversion: Price; @Input() blockConversion: Price;
@Output() txClickEvent = new EventEmitter<TransactionStripped>(); @Output() txClickEvent = new EventEmitter<{ tx: TransactionStripped, keyModifier: boolean}>();
@Output() txHoverEvent = new EventEmitter<string>(); @Output() txHoverEvent = new EventEmitter<string>();
@Output() readyEvent = new EventEmitter(); @Output() readyEvent = new EventEmitter();
@ -326,7 +326,9 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On
if (event.target === this.canvas.nativeElement && event.pointerType === 'touch') { if (event.target === this.canvas.nativeElement && event.pointerType === 'touch') {
this.setPreviewTx(event.offsetX, event.offsetY, true); this.setPreviewTx(event.offsetX, event.offsetY, true);
} else if (event.target === this.canvas.nativeElement) { } else if (event.target === this.canvas.nativeElement) {
this.onTxClick(event.offsetX, event.offsetY); const keyMod = event.shiftKey || event.ctrlKey || event.metaKey;
const middleClick = event.which === 2 || event.button === 1;
this.onTxClick(event.offsetX, event.offsetY, keyMod || middleClick);
} }
} }
@ -409,12 +411,12 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On
} }
} }
onTxClick(cssX: number, cssY: number) { onTxClick(cssX: number, cssY: number, keyModifier: boolean = false) {
const x = cssX * window.devicePixelRatio; const x = cssX * window.devicePixelRatio;
const y = cssY * window.devicePixelRatio; const y = cssY * window.devicePixelRatio;
const selected = this.scene.getTxAt({ x, y }); const selected = this.scene.getTxAt({ x, y });
if (selected && selected.txid) { if (selected && selected.txid) {
this.txClickEvent.emit(selected); this.txClickEvent.emit({ tx: selected, keyModifier });
} }
} }

View file

@ -612,9 +612,13 @@ export class BlockComponent implements OnInit, OnDestroy {
}); });
} }
onTxClick(event: TransactionStripped): void { onTxClick(event: { tx: TransactionStripped, keyModifier: boolean }): void {
const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.txid}`); const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.tx.txid}`);
this.router.navigate([url]); if (!event.keyModifier) {
this.router.navigate([url]);
} else {
window.open(url, '_blank');
}
} }
onTxHover(txid: string): void { onTxHover(txid: string): void {

View file

@ -107,8 +107,12 @@ export class MempoolBlockOverviewComponent implements OnInit, OnDestroy, OnChang
this.isLoading$.next(false); this.isLoading$.next(false);
} }
onTxClick(event: TransactionStripped): void { onTxClick(event: { tx: TransactionStripped, keyModifier: boolean }): void {
const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.txid}`); const url = new RelativeUrlPipe(this.stateService).transform(`/tx/${event.tx.txid}`);
this.router.navigate([url]); if (!event.keyModifier) {
this.router.navigate([url]);
} else {
window.open(url, '_blank');
}
} }
} }

View file

@ -13,7 +13,7 @@
</div> </div>
</div> </div>
<div class="header-bg box"> <div class="header-bg box" [attr.data-cy]="'tx-' + i">
<div *ngIf="errorUnblinded" class="error-unblinded">{{ errorUnblinded }}</div> <div *ngIf="errorUnblinded" class="error-unblinded">{{ errorUnblinded }}</div>
<div class="row"> <div class="row">