[accelerator] buttons

This commit is contained in:
Mononaut
2024-06-30 04:57:00 +00:00
parent d059c5ca27
commit 110b7a934c
4 changed files with 20 additions and 12 deletions

View File

@@ -81,6 +81,8 @@
<h2 i18n="transaction.accelerate|Accelerate button label">Transaction stuck?</h2>
</div>
<button type="button" class="btn btn-outline-info flow-toggle btn-sm float-right" (click)="closeAccelerator()" i18n="hide-diagram">Hide accelerator</button>
<div class="clearfix"></div>
<ng-container *ngIf="(ETA$ | async) as eta;">
@@ -546,7 +548,7 @@
<td>
<ng-container *ngIf="(ETA$ | async) as eta; else etaSkeleton">
@if (eta.blocks >= 7) {
<span [class]="(!tx?.acceleration && acceleratorAvailable && accelerateCtaType === 'button') ? 'etaDeepMempool d-flex justify-content-end align-items-center' : ''">
<span [class]="(!tx?.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !showAccelerationSummary) ? 'etaDeepMempool d-flex justify-content-end align-items-center' : ''">
<span i18n="transaction.eta.in-several-hours|Transaction ETA in several hours or more">In several hours (or more)</span>
@if (!tx?.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !showAccelerationSummary) {
<a class="btn btn-sm accelerateDeepMempool btn-small-height" i18n="transaction.accelerate|Accelerate button label" (click)="onAccelerateClicked()">Accelerate</a>
@@ -555,8 +557,13 @@
} @else if (network === 'liquid' || network === 'liquidtestnet') {
<app-time kind="until" [time]="eta.time" [fastRender]="false" [fixedRender]="true"></app-time>
} @else {
<span class="eta justify-content-end">
<span [class]="(!tx?.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !showAccelerationSummary) ? 'etaDeepMempool d-flex justify-content-end align-items-center' : ''">
<app-time kind="until" [time]="eta.time" [fastRender]="false" [fixedRender]="true"></app-time>
@if (!tx?.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !showAccelerationSummary) {
<a class="btn btn-sm accelerateDeepMempool btn-small-height" i18n="transaction.accelerate|Accelerate button label" (click)="onAccelerateClicked()">Accelerate</a>
}
</span>
<span class="eta justify-content-end">
</span>
}
</ng-container>

View File

@@ -421,8 +421,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
}
} else if (this.showAccelerationSummary) {
setTimeout(() => {
this.accelerationFlowCompleted = true;
this.showAccelerationSummary = false;
this.closeAccelerator();
}, 2000);
}
}
@@ -712,7 +711,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
document.location.hash = '#accelerate';
this.enterpriseService.goal(8);
this.accelerationFlowCompleted = false;
this.showAccelerationSummary = true && this.acceleratorAvailable;
this.showAccelerationSummary = this.acceleratorAvailable;
this.scrollIntoAccelPreview = true;
return false;
}
@@ -796,8 +795,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.showAccelerationSummary = false;
} else if (this.showAccelerationSummary) {
setTimeout(() => {
this.accelerationFlowCompleted = true;
this.showAccelerationSummary = false;
this.closeAccelerator();
}, 2000);
}
}
@@ -870,7 +868,6 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.showCpfpDetails = false;
this.accelerationInfo = null;
this.accelerationEligible = false;
this.accelerationFlowCompleted = false;
this.txInBlockIndex = null;
this.mempoolPosition = null;
this.pool = null;
@@ -887,6 +884,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.stateService.markBlock$.next({});
}
closeAccelerator(): void {
this.accelerationFlowCompleted = true;
this.showAccelerationSummary = false;
}
roundToOneDecimal(cpfpTx: any): number {
return +(cpfpTx.fee / (cpfpTx.weight / 4)).toFixed(1);
}