[accelerator] polish pizza accel

This commit is contained in:
nymkappa 2024-04-16 16:01:52 +09:00
parent 26807e80db
commit 64ba033602
No known key found for this signature in database
GPG Key ID: 92358FC85D9645DE
8 changed files with 40 additions and 31 deletions

View File

@ -1,4 +1,4 @@
<div class="container card h-100 w-100" style="padding: 20px; background: var(--box-bg)" id=acceleratePreviewAnchor> <div class="container-md card w-100" style="padding: 1em; background: var(--box-bg)" id=acceleratePreviewAnchor>
@if (error) { @if (error) {
<div class="mt-2"> <div class="mt-2">
@ -8,7 +8,7 @@
@else if (step === 'cta') { @else if (step === 'cta') {
<!-- Show A/B CTAs --> <!-- Show A/B CTAs -->
<div class="row mb-3"> <div class="row mb-1">
<div class="col-sm"> <div class="col-sm">
<h1 style="font-size: larger;">Accelerate your Bitcoin transaction?</h1> <h1 style="font-size: larger;">Accelerate your Bitcoin transaction?</h1>
</div> </div>
@ -17,11 +17,11 @@
<form> <form>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<div class="form-group form-check"> <div class="form-group form-check mb-2">
<input type="radio" class="form-check-input" id="accelerate" name="accelerate" (change)="selectedOptionChanged($event)"> <input type="radio" class="form-check-input" id="accelerate" name="accelerate" (change)="selectedOptionChanged($event)">
<label class="form-check-label d-flex flex-column" for="accelerate"> <label class="form-check-label d-flex flex-column" for="accelerate">
<span class="font-weight-bold">Accelerate</span> <span class="font-weight-bold">Accelerate</span>
<span style="color: rgb(186, 186, 186)">Settlement expected in ~1 hour or less<br> <span style="color: rgb(186, 186, 186); font-size: 14px;">Settlement expected in ~1 hour or less<br>
@if (!calculating) { @if (!calculating) {
<app-fiat [value]="cost"></app-fiat>fee (<span><small style="font-family: monospace;">{{ cost | number }}</small>&nbsp;<span class="symbol" i18n="shared.sats|sats">sats</span></span>) <app-fiat [value]="cost"></app-fiat>fee (<span><small style="font-family: monospace;">{{ cost | number }}</small>&nbsp;<span class="symbol" i18n="shared.sats|sats">sats</span></span>)
} @else { } @else {
@ -34,19 +34,19 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<div class="form-group form-check"> <div class="form-group form-check mb-2">
<input type="radio" class="form-check-input" id="wait" name="accelerate" (change)="selectedOptionChanged($event)"> <input type="radio" class="form-check-input" id="wait" name="accelerate" (change)="selectedOptionChanged($event)">
<label class="form-check-label d-flex flex-column" for="wait"> <label class="form-check-label d-flex flex-column" for="wait">
<span class="font-weight-bold">Wait</span> <span class="font-weight-bold">Wait</span>
<span style="color: rgb(186, 186, 186)">Settlement expected to occur <app-time kind="within" [time]="eta" [fastRender]="false" [fixedRender]="true"></app-time></span> <span style="color: rgb(186, 186, 186); font-size: 14px;">Settlement expected to occur <app-time kind="within" [time]="eta" [fastRender]="false" [fixedRender]="true"></app-time></span>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<div class="row mt-2" [style]="(choosenOption === 'wait' || calculating) ? 'opacity: 0.25; pointer-events: none' : ''"> <div class="row mt-2 mb-2" [style]="(choosenOption === 'wait' || calculating) ? 'opacity: 0.25; pointer-events: none' : ''">
<div class="col-sm d-flex flex-row justify-content-center"> <div class="col-sm d-flex flex-row justify-content-center">
<button type="button" class="mt-1 btn btn-light rounded-pill align-self-center d-flex flex-row justify-content-center align-items-center" style="width: 200px" (click)="enableCheckoutPage()"> <button type="button" class="mt-1 btn btn-purple rounded-pill align-self-center d-flex flex-row justify-content-center align-items-center" style="width: 200px" (click)="enableCheckoutPage()">
<img src="/resources/mempool-accelerator-sparkles-compressed.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>
</div> </div>
@ -56,7 +56,7 @@
@else if (step === 'checkout') { @else if (step === 'checkout') {
<!-- Show checkout page --> <!-- Show checkout page -->
<div class="row mb-3 text-center"> <div class="row mb-md-1 text-center">
<div class="col-sm"> <div class="col-sm">
<h1 style="font-size: larger;">Confirm your payment</h1> <h1 style="font-size: larger;">Confirm your payment</h1>
</div> </div>
@ -64,7 +64,7 @@
<div class="row text-center"> <div class="row text-center">
<div class="col-sm"> <div class="col-sm">
<div class="form-group w-100"> <div class="form-group w-100" style="font-size: 14px">
Payment to mempool.space for acceleration of txid <a [routerLink]="'/tx/' + txid" target="_blank">{{ txid.substr(0, 10) }}..{{ txid.substr(-10) }}</a> Payment to mempool.space for acceleration of txid <a [routerLink]="'/tx/' + txid" target="_blank">{{ txid.substr(0, 10) }}..{{ txid.substr(-10) }}</a>
</div> </div>
</div> </div>
@ -104,13 +104,13 @@
<div class="row mt-2 mb-2 text-center"> <div class="row mt-2 mb-2 text-center">
<div class="col-sm d-flex flex-column"> <div class="col-sm d-flex flex-column">
<small>Changed your mind?</small> <small>Changed your mind?</small>
<button type="button" class="mt-1 btn btn-secondary btn-sm rounded-pill align-self-center" style="width: 200px" (click)="restart(); closeModal()">Close</button> <button type="button" class="mt-1 btn btn-secondary btn-sm rounded-pill align-self-center" style="width: 200px" (click)="restart()">Go Back</button>
</div> </div>
</div> </div>
} }
@else if (step === 'processing') { @else if (step === 'processing') {
<div class="row mb-3 text-center"> <div class="row mb-1 text-center">
<div class="col-sm"> <div class="col-sm">
<h1 style="font-size: larger;">Confirm your payment</h1> <h1 style="font-size: larger;">Confirm your payment</h1>
</div> </div>
@ -130,6 +130,4 @@
</div> </div>
} }
<span class="close-button" (click)="closeModal()"></span>
</div> </div>

View File

@ -29,7 +29,7 @@
</div> </div>
<div class="data"> <div class="data">
@if (tx && !tx.status?.confirmed && mempoolPosition?.block != null) { @if (tx && !tx.status?.confirmed && mempoolPosition?.block != null) {
<div class="field"> <div class="field narrower mt-2">
<div class="label" i18n="transaction.first-seen|Transaction first seen">First seen</div> <div class="label" i18n="transaction.first-seen|Transaction first seen">First seen</div>
<div class="value"> <div class="value">
@if (transactionTime > 0) { @if (transactionTime > 0) {
@ -39,7 +39,7 @@
} }
</div> </div>
</div> </div>
<div class="field"> <div class="field narrower">
<div class="label" i18n="transaction.eta|Transaction ETA">ETA</div> <div class="label" i18n="transaction.eta|Transaction ETA">ETA</div>
<div class="value"> <div class="value">
<span class="justify-content-end d-flex align-items-center"> <span class="justify-content-end d-flex align-items-center">
@ -48,14 +48,14 @@
} @else { } @else {
<app-time kind="until" *ngIf="(da$ | async) as da;" [time]="da.adjustedTimeAvg * (mempoolPosition.block + 1) + now + da.timeOffset" [fastRender]="false" [fixedRender]="true"></app-time> <app-time kind="until" *ngIf="(da$ | async) as da;" [time]="da.adjustedTimeAvg * (mempoolPosition.block + 1) + now + da.timeOffset" [fastRender]="false" [fixedRender]="true"></app-time>
} }
@if (isMobile && paymentType === 'cashapp' && accelerationEligible && !tx.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !tx?.acceleration) { @if (!showAccelerationSummary && isMobile && paymentType === 'cashapp' && accelerationEligible && !tx.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !tx?.acceleration) {
<a class="btn btn-sm accelerate btn-small-height" i18n="transaction.accelerate|Accelerate button label" (click)="onAccelerateClicked()">Accelerate</a> <a class="btn btn-sm accelerate btn-small-height" i18n="transaction.accelerate|Accelerate button label" (click)="onAccelerateClicked()">Accelerate</a>
} }
</span> </span>
</div> </div>
</div> </div>
} @else if (tx && tx.status?.confirmed) { } @else if (tx && tx.status?.confirmed) {
<div class="field"> <div class="field narrower mt-2">
<div class="label" i18n="transaction.confirmed-at">Confirmed at</div> <div class="label" i18n="transaction.confirmed-at">Confirmed at</div>
<div class="value"> <div class="value">
&lrm;{{ tx.status.block_time * 1000 | date:'yyyy-MM-dd HH:mm' }} &lrm;{{ tx.status.block_time * 1000 | date:'yyyy-MM-dd HH:mm' }}
@ -64,7 +64,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="field"> <div class="field narrower">
<div class="label" i18n="transaction.block-height">Block height</div> <div class="label" i18n="transaction.block-height">Block height</div>
<div class="value"> <div class="value">
<span class="justify-content-end d-flex align-items-center"> <span class="justify-content-end d-flex align-items-center">

View File

@ -92,6 +92,10 @@
white-space: nowrap; white-space: nowrap;
text-align: end; text-align: end;
} }
&.narrower {
padding-top: 0.75em !important;
padding-bottom: 0.75em !important;
}
} }
.tracker-bar { .tracker-bar {

View File

@ -143,7 +143,7 @@ export class TrackerComponent implements OnInit, OnDestroy {
this.acceleratorAvailable = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === ''; this.acceleratorAvailable = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === '';
if (this.acceleratorAvailable && this.stateService.ref === 'https://cash.app/') { if (this.acceleratorAvailable && this.stateService.referrer === 'https://cash.app/') {
this.paymentType = 'cashapp'; this.paymentType = 'cashapp';
} }
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);

View File

@ -745,11 +745,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
} }
resetTransaction() { resetTransaction() {
if (!this.firstLoad) {
this.stateService.ref = '';
} else {
this.firstLoad = false; this.firstLoad = false;
}
this.error = undefined; this.error = undefined;
this.tx = null; this.tx = null;
this.setFeatures(); this.setFeatures();
@ -845,7 +841,6 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
} }
ngOnDestroy() { ngOnDestroy() {
this.stateService.ref = '';
this.subscription.unsubscribe(); this.subscription.unsubscribe();
this.fetchCpfpSubscription.unsubscribe(); this.fetchCpfpSubscription.unsubscribe();
this.fetchRbfSubscription.unsubscribe(); this.fetchRbfSubscription.unsubscribe();

View File

@ -86,7 +86,7 @@ const defaultEnv: Env = {
providedIn: 'root' providedIn: 'root'
}) })
export class StateService { export class StateService {
ref: string = ''; referrer: string = '';
isBrowser: boolean = isPlatformBrowser(this.platformId); isBrowser: boolean = isPlatformBrowser(this.platformId);
isMempoolSpaceBuild = window['isMempoolSpaceBuild'] ?? false; isMempoolSpaceBuild = window['isMempoolSpaceBuild'] ?? false;
backend: 'esplora' | 'electrum' | 'none' = 'esplora'; backend: 'esplora' | 'electrum' | 'none' = 'esplora';
@ -164,7 +164,7 @@ export class StateService {
private router: Router, private router: Router,
private storageService: StorageService, private storageService: StorageService,
) { ) {
this.ref = window.document.referrer; this.referrer = window.document.referrer;
const browserWindow = window || {}; const browserWindow = window || {};
// @ts-ignore // @ts-ignore
@ -192,7 +192,7 @@ export class StateService {
} }
}); });
if (this.ref === 'https://cash.app/' && window.innerWidth < 850 && window.location.pathname.startsWith('/tx/')) { if (this.referrer === 'https://cash.app/' && window.innerWidth < 850 && window.location.pathname.startsWith('/tx/')) {
this.router.navigate(['/tracker/' + window.location.pathname.slice(4)]); this.router.navigate(['/tracker/' + window.location.pathname.slice(4)]);
} }

View File

@ -1 +0,0 @@
<svg data-name="Layer 1" width="979.085" height="747.647" viewBox="0 0 734.315 560.74" xmlns="http://www.w3.org/2000/svg"><path style="fill:#7b61aa;fill-rule:evenodd;stroke-width:0" transform="translate(-68.202 -122.51)" d="m470.9 400.54 53.51 20.55-19.71 51.32 37.42 14.36 19.7-51.32 52.64 20.21 15.39-40.09-52.64-20.21 20.02-52.15-37.41-14.36L539.8 381l-53.51-20.55zm-47.17 235.11 53.73-19.96 19.14 51.53 37.57-13.95-19.14-51.53 52.85-19.64-14.95-40.25-52.85 19.63-19.45-52.36-37.57 13.95 19.45 52.37-53.73 19.95zM83.14 479.9l53.73-19.96 19.15 51.53 37.57-13.95-19.14-51.53 52.85-19.64-14.95-40.25-52.86 19.63-19.45-52.36-37.57 13.95 19.45 52.37-53.73 19.95zM403 288.01l49.16-29.46 28.26 47.16 34.38-20.6-28.25-47.15 48.36-28.98-22.07-36.84-48.36 28.98-28.71-47.92-34.38 20.6 28.7 47.92-49.16 29.45zm-249.99-26.6 69.39-11.35 10.88 66.56 48.53-7.94-10.88-66.55 68.25-11.16-8.5-51.99-68.25 11.16-11.06-67.63-48.53 7.93 11.06 67.63-69.39 11.35zm169.87 173.4 40.47 9.7-9.3 38.8 28.29 6.78 9.3-38.8 39.8 9.53 7.26-30.31-39.8-9.54 9.45-39.43-28.29-6.78-9.45 39.43-40.46-9.69zm356.55 109.52 45.87-33 31.65 44 32.08-23.08-31.65-44 45.13-32.46-24.73-34.37-45.12 32.46-32.16-44.71-32.08 23.08 32.16 44.71-45.88 33zm-46.36 103.16 41.42-3.97 3.8 39.73 28.96-2.78-3.8-39.72 40.74-3.9-2.97-31.03-40.74 3.9-3.86-40.36-28.97 2.77 3.87 40.36-41.42 3.97z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="uuid-8b8cac90-7c63-4c4e-9c11-a275d2b48bea" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" width="734.31" height="560.74" viewBox="0 0 734.31 560.74">
<g id="uuid-519a27c0-8439-4bce-979b-8dc9cda643bc" data-name="Layer 1">
<polygon points="529.04 220.7 491.62 206.34 471.6 258.49 418.09 237.95 402.7 278.04 456.21 298.58 436.51 349.9 473.93 364.27 493.63 312.94 546.27 333.15 561.66 293.06 509.02 272.85 529.04 220.7" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="412.44 386.61 374.87 400.56 394.32 452.93 340.59 472.89 355.54 513.14 409.27 493.18 428.41 544.72 465.98 530.76 446.84 479.23 499.69 459.6 484.74 419.34 431.89 438.97 412.44 386.61" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="71.85 230.86 34.28 244.81 53.73 297.18 0 317.14 14.95 357.39 68.68 337.43 87.82 388.97 125.4 375.01 106.25 323.48 159.11 303.85 144.15 263.59 91.3 283.22 71.85 230.86" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="367.58 30.69 333.19 51.29 361.9 99.21 312.73 128.67 334.8 165.5 383.97 136.05 412.23 183.21 446.61 162.61 418.35 115.45 466.72 86.47 444.65 49.64 396.28 78.61 367.58 30.69" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="183.18 0 134.65 7.93 145.71 75.56 76.32 86.91 84.82 138.9 154.21 127.55 165.09 194.11 213.62 186.18 202.73 119.62 270.99 108.46 262.49 56.47 194.23 67.63 183.18 0" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="340.16 259.03 311.87 252.25 302.42 291.69 261.96 281.99 254.69 312.3 295.15 322 285.85 360.81 314.15 367.59 323.45 328.78 363.25 338.32 370.51 308 330.71 298.47 340.16 259.03" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="632.31 286.67 600.23 309.74 632.39 354.45 586.51 387.45 611.24 421.82 657.11 388.82 688.76 432.82 720.84 409.75 689.19 365.75 734.31 333.29 709.59 298.92 664.47 331.38 632.31 286.67" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
<polygon points="628.42 446.85 599.46 449.62 603.33 489.99 561.91 493.95 564.88 524.98 606.3 521.02 610.1 560.74 639.06 557.97 635.26 518.24 676 514.35 673.03 483.32 632.29 487.22 628.42 446.85" style="fill: #fff; fill-rule: evenodd; stroke-width: 0px;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB