[accelerator] slim summary screen

This commit is contained in:
Mononaut 2024-06-30 03:43:28 +00:00
parent bf37affe47
commit d059c5ca27
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
4 changed files with 47 additions and 49 deletions

View File

@ -266,36 +266,23 @@
@else if (step === 'summary') { @else if (step === 'summary') {
<ng-container *ngIf="estimate && (etaInfo$ | async) as etaInfo; else loadingSummary"> <ng-container *ngIf="estimate && (etaInfo$ | async) as etaInfo; else loadingSummary">
<!-- Show A/B CTAs --> <!-- Show A/B CTAs -->
@if (!noCTA) {
<div class="row mb-1"> <div class="row mb-1">
<div class="col-sm"> <div class="col-sm">
<h1 style="font-size: larger;"><ng-content select="[slot='cta-title']"></ng-content><span class="default-slot">Accelerate your Bitcoin transaction?</span></h1> <h1 style="font-size: larger;"><ng-content select="[slot='cta-title']"></ng-content><span class="default-slot">Accelerate your Bitcoin transaction?</span></h1>
</div> </div>
</div> </div>
}
<div *ngIf="isLoggedIn() && !estimate.hasAccess"> <div *ngIf="isLoggedIn() && !estimate.hasAccess">
<div class="alert alert-mempool mr-6">You are currently on the waitlist for Mempool Accelerator&trade;</div> <div class="alert alert-mempool mr-6">You are currently on the waitlist for Mempool Accelerator&trade;</div>
</div> </div>
<form [class]="{estimateDisabled: error || showSuccess }"> <form [class]="{estimateDisabled: error || showSuccess }">
<div class="row"> <div class="row summary-row">
<div class="col-md"> <div>
<div class="form-group form-check mb-2"> <div class="form-group form-check mb-2">
<input type="radio" [checked]="choosenOption === 'wait'" class="form-check-input" id="wait" name="accel" (change)="selectedOptionChanged($event)"> <input type="checkbox" [checked]="armed" class="form-check-input" id="accel" name="accel" (change)="armed = !armed">
<label class="form-check-label d-flex flex-column" for="wait">
<span class="font-weight-bold">Wait</span>
@if (eta.blocks < 7) {
<span class="checkout-text">Confirmation expected <app-time kind="within" [time]="eta.time" [fastRender]="false" [fixedRender]="true"></app-time></span>
} @else {
<span class="checkout-text">
<span>Confirmation expected within several hours</span>
</span>
}
</label>
</div>
</div>
<div class="col-md">
<div class="form-group form-check mb-2">
<input type="radio" [checked]="choosenOption === 'accel'" class="form-check-input" id="accel" name="accel" (change)="selectedOptionChanged($event)">
<label class="form-check-label d-flex flex-column" for="accel"> <label class="form-check-label d-flex flex-column" for="accel">
<span><b>Accelerate</b> to ~{{ ((userBid + estimate.txSummary.effectiveFee) / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} sat/vB <button class="btn btn-sm btn-accelerate btn-small-height ml-3" i18n="accelerator.customize" (click)="moveToStep('quote')">customize</button></span> <span><b>Accelerate</b> to ~{{ ((userBid + estimate.txSummary.effectiveFee) / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} sat/vB <button class="btn btn-sm btn-accelerate btn-small-height ml-3" i18n="accelerator.customize" (click)="moveToStep('quote')">customize</button></span>
<span class="checkout-text">Confirmation expected <app-time kind="within" [time]="etaInfo.acceleratedETA" [fastRender]="false" [fixedRender]="true"></app-time><br> <span class="checkout-text">Confirmation expected <app-time kind="within" [time]="etaInfo.acceleratedETA" [fastRender]="false" [fixedRender]="true"></app-time><br>
@ -308,15 +295,12 @@
</label> </label>
</div> </div>
</div> </div>
<div class="col-md pie d-none d-lg-flex" *ngIf="!forceMobile"> <div class="pie d-none d-lg-flex" *ngIf="!forceMobile">
<small class="form-text text-muted mb-2" i18n="accelerator.hashrate-percentage-description">Your transaction will be prioritized by up to {{ etaInfo.hashratePercentage | number : '1.1-1' }}% of miners.</small> <small class="form-text text-muted mb-2" i18n="accelerator.hashrate-percentage-description">Your transaction will be prioritized by up to {{ etaInfo.hashratePercentage | number : '1.1-1' }}% of miners.</small>
<app-active-acceleration-box [miningStats]="miningStats" [pools]="estimate.pools" [chartOnly]="true"></app-active-acceleration-box> <app-active-acceleration-box [miningStats]="miningStats" [pools]="estimate.pools" [chartOnly]="true"></app-active-acceleration-box>
</div> </div>
</div>
<div class="row mt-2 mb-2">
<div class="col-sm d-flex flex-row justify-content-center">
@if (isLoggedIn() || canPayWithBitcoin || canPayWithCashapp) { @if (isLoggedIn() || canPayWithBitcoin || canPayWithCashapp) {
<button type="button" class="mt-1 btn btn-purple rounded-pill align-self-center d-flex flex-row justify-content-center align-items-center" [class.estimateDisabled]="!canPay || choosenOption !== 'accel' || calculating" style="width: 200px" (click)="accelerate()"> <button type="button" class="mt-1 btn btn-purple rounded-pill align-self-center d-flex flex-row justify-content-center align-items-center" [class.estimateDisabled]="!canPay || !armed || calculating" style="width: 200px" (click)="accelerate()">
<img src="/resources/mempool-accelerator-sparkles-light.svg" height="20" class="mr-2" style="margin-left: -10px"> <img src="/resources/mempool-accelerator-sparkles-light.svg" height="20" class="mr-2" style="margin-left: -10px">
<span>Accelerate</span> <span>Accelerate</span>
</button> </button>
@ -327,7 +311,6 @@
</button> </button>
} }
</div> </div>
</div>
</form> </form>
</ng-container> </ng-container>
<ng-template #loadingSummary> <ng-template #loadingSummary>

View File

@ -172,3 +172,16 @@
.btn-small-height { .btn-small-height {
line-height: 1; line-height: 1;
} }
.summary-row {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0 2em;
flex-wrap: wrap;
@media (max-width: 640px) {
flex-direction: column;
}
}

View File

@ -56,10 +56,11 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
@Input() cashappEnabled: boolean = true; @Input() cashappEnabled: boolean = true;
@Input() advancedEnabled: boolean = false; @Input() advancedEnabled: boolean = false;
@Input() forceMobile: boolean = false; @Input() forceMobile: boolean = false;
@Input() noCTA: boolean = false;
@Output() changeMode = new EventEmitter<boolean>(); @Output() changeMode = new EventEmitter<boolean>();
calculating = true; calculating = true;
choosenOption: 'wait' | 'accel'; armed = false;
error = ''; error = '';
math = Math; math = Math;
isMobile: boolean = window.innerWidth <= 767.98; isMobile: boolean = window.innerWidth <= 767.98;
@ -445,13 +446,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
}); });
} }
/**
* UI events
*/
selectedOptionChanged(event) {
this.choosenOption = event.target.id;
}
isLoggedIn(): boolean { isLoggedIn(): boolean {
const auth = this.storageService.getAuth(); const auth = this.storageService.getAuth();
return auth !== null; return auth !== null;

View File

@ -84,9 +84,17 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<ng-container *ngIf="(ETA$ | async) as eta;"> <ng-container *ngIf="(ETA$ | async) as eta;">
<app-accelerate-checkout *ngIf="(da$ | async) as da;" [cashappEnabled]="accelerationEligible" [advancedEnabled]="true" [tx]="tx" [eta]="eta" [miningStats]="miningStats" [scrollEvent]="scrollIntoAccelPreview" class="h-100 w-100"> <app-accelerate-checkout
<span slot="cta-title">Mempool Accelerator&trade; fixes this.</span> *ngIf="(da$ | async) as da;"
</app-accelerate-checkout> [cashappEnabled]="accelerationEligible"
[advancedEnabled]="true"
[tx]="tx"
[eta]="eta"
[miningStats]="miningStats"
[scrollEvent]="scrollIntoAccelPreview"
[noCTA]="true"
class="h-100 w-100"
></app-accelerate-checkout>
</ng-container> </ng-container>
</ng-container> </ng-container>