From 3325db48830291c482f329cadee3a8bbfeefbb76 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Mon, 13 Jan 2025 11:06:21 +0900 Subject: [PATCH] [accelerator] add btcpay invoice retry button and polish checkout UI --- .../accelerate-checkout.component.html | 15 +++++++++------ .../accelerate-checkout.component.scss | 18 ++++++++++++++++++ .../accelerate-checkout.component.ts | 5 +++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html index df67de65c..3fd92939a 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html @@ -357,9 +357,9 @@ -
+
-

Payment to mempool.space for acceleration of txid {{ tx.txid.substr(0, 10) }}..{{ tx.txid.substr(-10) }}

+ Payment to mempool.space for acceleration of txid {{ tx.txid.substr(0, 10) }}..{{ tx.txid.substr(-10) }}
@if (canPayWithBalance || !(canPayWithBitcoin || canPayWithCashapp)) {
@@ -378,9 +378,12 @@

Pay {{ ((invoice.btcDue * 100_000_000) || cost) | number }} sats

} @else if (btcpayInvoiceFailed) { -

Failed to load invoice

-
- +
+ + Failed to load invoice + @if (!loadingBtcpayInvoice) { + + }
} @else {

Loading invoice...

@@ -391,7 +394,7 @@
@if (canPayWithCashapp || canPayWithApplePay || canPayWithGooglePay) {
-

OR

+

—— OR ——

} } diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.scss b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.scss index ad085ed20..fd9ad06ec 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.scss +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.scss @@ -146,6 +146,11 @@ .payment-area { background: var(--bg); + margin-top: 0.5rem; + padding: 0.5rem; + @media (max-width: 575px) { + padding-bottom: 1.25rem; + } } .col.pie { @@ -212,4 +217,17 @@ } .apple-pay-button-white-with-line { -apple-pay-button-style: white-outline; +} + +.btcpay-invoice { + display: flex; + height: 292px; + flex-direction: column; + justify-content: center; + align-items: center; + @media (max-width: 575px) { + height: 75px; + flex-direction: row; + gap: 5px; + } } \ No newline at end of file diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts index 4c935c57f..e675b6440 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts @@ -214,7 +214,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy { } if (this._step === 'checkout' && this.canPayWithBitcoin) { this.btcpayInvoiceFailed = false; - this.loadingBtcpayInvoice = true; this.invoice = null; this.requestBTCPayInvoice(); } else if (this._step === 'cashapp' && this.cashappEnabled) { @@ -323,7 +322,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy { } if (this.step === 'checkout' && this.canPayWithBitcoin && !this.loadingBtcpayInvoice) { - this.loadingBtcpayInvoice = true; this.requestBTCPayInvoice(); } @@ -782,16 +780,19 @@ export class AccelerateCheckout implements OnInit, OnDestroy { * BTCPay */ async requestBTCPayInvoice(): Promise { + this.loadingBtcpayInvoice = true; this.servicesApiService.generateBTCPayAcceleratorInvoice$(this.tx.txid, this.userBid).pipe( switchMap(response => { return this.servicesApiService.retreiveInvoice$(response.btcpayInvoiceId); }), catchError(error => { console.log(error); + this.loadingBtcpayInvoice = false; this.btcpayInvoiceFailed = true; return of(null); }) ).subscribe((invoice) => { + this.loadingBtcpayInvoice = false; this.invoice = invoice; this.cd.markForCheck(); });