fix: show empty cart if cart is empty

This commit is contained in:
kusowl 2026-03-25 15:48:14 +05:30
parent aa35fe44b3
commit 0c349d816c

View File

@ -5,19 +5,20 @@
<li><a class="block h-full w-full">Loading</a></li> <li><a class="block h-full w-full">Loading</a></li>
} @else { } @else {
<ol <ol
[class.pointer-events-none]="isLoading()"
[class.opacity-40]="isLoading()"
[class.cursor-block]="isLoading()" [class.cursor-block]="isLoading()"
[class.opacity-40]="isLoading()"
[class.pointer-events-none]="isLoading()"
class="rounded-none!" class="rounded-none!"
> >
@for (item of cart.items; track item.id) { @for (item of cart.items; track item.id) {
<app-cart-item <app-cart-item
(qtyChangeEvent)="updateProductQty($event)"
(productDeleteEvent)="removeProduct($event)" (productDeleteEvent)="removeProduct($event)"
(qtyChangeEvent)="updateProductQty($event)"
[cartItem]="item" [cartItem]="item"
/> />
} }
</ol> </ol>
@if (cart.itemsCount > 0) {
<div class="flex justify-between mt-4 px-2 font-bold text-lg"> <div class="flex justify-between mt-4 px-2 font-bold text-lg">
<p>Total</p> <p>Total</p>
@ -28,4 +29,8 @@
<a [routerLink]="`/checkout/address`" class="btn btn-primary px-4">Proceed to checkout</a> <a [routerLink]="`/checkout/address`" class="btn btn-primary px-4">Proceed to checkout</a>
</li> </li>
} }
@else{
<li><a class="block h-full w-full">Cart is empty !</a></li>
}
}
</ul> </ul>