diff --git a/src/app/components/cart/components/cart-modal/cart-modal.component.html b/src/app/components/cart/components/cart-modal/cart-modal.component.html
index a8ffc07..882b497 100644
--- a/src/app/components/cart/components/cart-modal/cart-modal.component.html
+++ b/src/app/components/cart/components/cart-modal/cart-modal.component.html
@@ -357,8 +357,8 @@
Your Cart
nzType="default"
[disabled]="
((cartService.pendingTransaction$ | async) &&
- !helper.isExpired(cartService.pendingTransaction$ | async) &&
- (cartService.selectedNetwork$ | async) === item.pricing.tokenSymbol) ||
+ !helper.isExpired(cartService.pendingTransaction$ | async) &&
+ (cartService.selectedNetwork$ | async) === item.pricing.tokenSymbol) ||
(isLoading$ | async)
"
(click)="removeFromCart(item)"
@@ -384,7 +384,7 @@ Your Cart
Your cart is empty.
- Pending Transaction: {{ (cartService.pendingTransaction$ | async) }}
+ Pending Transaction: {{ cartService.pendingTransaction$ | async }}
Transaction Expired: {{ helper.isExpired(cartService.pendingTransaction$ | async) }}
@@ -407,7 +407,11 @@ Your Cart
nz-button
nzType="default"
(click)="clearCart()"
- [disabled]="(cartService.pendingTransaction$ | async) && !helper.isExpired(cartService.pendingTransaction$ | async) || (isLoading$ | async)"
+ [disabled]="
+ ((cartService.pendingTransaction$ | async) &&
+ !helper.isExpired(cartService.pendingTransaction$ | async)) ||
+ (isLoading$ | async)
+ "
nz-tooltip
[nzTooltipTitle]="(isLoading$ | async) ? 'Waiting for cart items to finish loading' : ''"
class="text-red-600 hover:text-red-800"
@@ -425,7 +429,6 @@ Your Cart
Checkout
-
diff --git a/src/app/components/cart/components/cart-modal/cart-modal.component.ts b/src/app/components/cart/components/cart-modal/cart-modal.component.ts
index e78cc7d..ff69319 100644
--- a/src/app/components/cart/components/cart-modal/cart-modal.component.ts
+++ b/src/app/components/cart/components/cart-modal/cart-modal.component.ts
@@ -1,4 +1,10 @@
-import { Component, OnDestroy, ChangeDetectorRef, ChangeDetectionStrategy, OnInit } from '@angular/core';
+import {
+ Component,
+ OnDestroy,
+ ChangeDetectorRef,
+ ChangeDetectionStrategy,
+ OnInit,
+} from '@angular/core';
import { Network, Transaction } from '@build-5/interfaces';
import { Subscription, take, of, Observable, BehaviorSubject, Subject } from 'rxjs';
import { CartService, CartItem } from '@components/cart/services/cart.service';
@@ -9,7 +15,7 @@ import { UnitsService } from '@core/services/units/units.service';
import { map, switchMap, tap } from 'rxjs/operators';
import { DeviceService } from '@core/services/device';
import { HelperService } from '@pages/nft/services/helper.service';
-import { } from '@angular/core';
+import {} from '@angular/core';
export enum StepType {
CONFIRM = 'Confirm',
@@ -52,7 +58,7 @@ export class CartModalComponent implements OnInit, OnDestroy {
public currentStep: StepType | null = null;
public isTransactionExpired: boolean | null = null;
public selectedNetwork: string | null = null;
- public isLoading: boolean = false;
+ public isLoading = false;
public pendingTransaction: Transaction | undefined = undefined;
constructor(
@@ -67,43 +73,43 @@ export class CartModalComponent implements OnInit, OnDestroy {
ngOnInit() {
this.subscriptions$.add(
- this.cartService.currentStep$.subscribe(step => {
- this.currentStep = step;
- this.triggerChangeDetection();
- })
+ this.cartService.currentStep$.subscribe((step) => {
+ this.currentStep = step;
+ this.triggerChangeDetection();
+ }),
);
this.subscriptions$.add(
- this.cartService.selectedNetwork$.subscribe(network => {
- this.selectedNetwork = network;
- this.triggerChangeDetection();
- })
+ this.cartService.selectedNetwork$.subscribe((network) => {
+ this.selectedNetwork = network;
+ this.triggerChangeDetection();
+ }),
);
this.subscriptions$.add(
- this.cartService.pendingTransaction$.subscribe(transaction => {
+ this.cartService.pendingTransaction$.subscribe((transaction) => {
this.pendingTransaction = transaction;
this.triggerChangeDetection();
- })
+ }),
);
this.subscriptions$.add(
- this.cartService.isLoading$.subscribe(loading => {
- this.isLoading = loading;
- this.triggerChangeDetection();
- })
+ this.cartService.isLoading$.subscribe((loading) => {
+ this.isLoading = loading;
+ this.triggerChangeDetection();
+ }),
);
this.subscriptions$.add(
- this.cartService.cartUpdateObservable$.subscribe(() => {
- this.triggerChangeDetection();
- })
+ this.cartService.cartUpdateObservable$.subscribe(() => {
+ this.triggerChangeDetection();
+ }),
);
this.subscriptions$.add(
this.cartService.triggerChangeDetectionSubject$.subscribe(() => {
- this.triggerChangeDetection();
- })
+ this.triggerChangeDetection();
+ }),
);
}
diff --git a/src/app/components/cart/components/checkout/checkout-overlay.component.html b/src/app/components/cart/components/checkout/checkout-overlay.component.html
index a701645..b8932f6 100644
--- a/src/app/components/cart/components/checkout/checkout-overlay.component.html
+++ b/src/app/components/cart/components/checkout/checkout-overlay.component.html
@@ -26,8 +26,8 @@
Network: {{ group.tokenSymbol }} -
- {{ group.totalQuantity }} NFTs in network group
- with total Price of
+ {{ group.totalQuantity }} NFTs in network group with
+ total Price of
{{ group.totalPrice | formatToken : group.network : true : true | async }} ({{
unitsService.getUsd(
cartService.valueDivideExponent({
diff --git a/src/app/components/cart/services/cart.service.ts b/src/app/components/cart/services/cart.service.ts
index 3124690..b3eaee4 100644
--- a/src/app/components/cart/services/cart.service.ts
+++ b/src/app/components/cart/services/cart.service.ts
@@ -121,39 +121,42 @@ export class CartService {
private listenToStorageChanges(): void {
window.addEventListener('storage', (event) => {
- if (event.storageArea === localStorage) {
- this.zone.run(() => {
- switch (event.key) {
- case CART_STORAGE_KEY:
- const updatedCartItems = JSON.parse(event.newValue || '[]');
- this.cartItemsSubject$.next(updatedCartItems);
- break;
- case NETWORK_STORAGE_KEY:
- const updatedNetwork = JSON.parse(event.newValue || 'null');
- this.selectedNetworkSubject$.next(updatedNetwork);
- break;
- case STEP_STORAGE_KEY:
- const newStep = JSON.parse(event.newValue || 'null');
- this.currentStepSubject$.next(newStep);
- break;
- case TRAN_STORAGE_KEY:
- const newTran = JSON.parse(event.newValue || 'null');
- this.pendingTransaction$.next(newTran);
- break;
- }
- this.cartUpdateSubject$.next();
- });
- }
+ if (event.storageArea === localStorage) {
+ this.zone.run(() => {
+ switch (event.key) {
+ case CART_STORAGE_KEY: {
+ const updatedCartItems = JSON.parse(event.newValue || '[]');
+ this.cartItemsSubject$.next(updatedCartItems);
+ break;
+ }
+ case NETWORK_STORAGE_KEY: {
+ const updatedNetwork = JSON.parse(event.newValue || 'null');
+ this.selectedNetworkSubject$.next(updatedNetwork);
+ break;
+ }
+ case STEP_STORAGE_KEY: {
+ const newStep = JSON.parse(event.newValue || 'null');
+ this.currentStepSubject$.next(newStep);
+ break;
+ }
+ case TRAN_STORAGE_KEY: {
+ const newTran = JSON.parse(event.newValue || 'null');
+ this.pendingTransaction$.next(newTran);
+ break;
+ }
+ }
+ this.cartUpdateSubject$.next();
+ });
+ }
});
}
public startTransactionExpiryCheck(): void {
if (this.transactionCheckInterval) {
- clearInterval(this.transactionCheckInterval);
+ clearInterval(this.transactionCheckInterval);
}
this.transactionCheckInterval = setInterval(() => {
-
const transaction = this.pendingTransaction$.getValue();
const currentStep = this.getCurrentStep();
if (currentStep === StepType.TRANSACTION || currentStep === StepType.WAIT) {