loyalty points

This commit is contained in:
augmentedpotato
2026-04-15 01:34:49 -06:00
parent 1636ba14b6
commit 2c1871b6e2
5 changed files with 32 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ function PaymentForm({ clientSecret, totalAmount, onSuccess, onCancel }) {
}
export default function CartPage() {
const { user, loading: authLoading } = useAuth();
const { user, loading: authLoading, refreshUser } = useAuth();
const {
cart,
cartLoading,
@@ -373,6 +373,12 @@ export default function CartPage() {
</div>
)}
{user?.role === "CUSTOMER" && (
<div className="cart-points-estimate">
Earn <strong>{Math.floor(parseFloat(cart.totalAmount ?? 0))}</strong> loyalty point{Math.floor(parseFloat(cart.totalAmount ?? 0)) !== 1 ? "s" : ""} with this purchase
</div>
)}
<div className="cart-coupon-section">
{cart.couponCode && (
<div className="cart-coupon-applied">
@@ -444,6 +450,7 @@ export default function CartPage() {
onSuccess={() => {
setClientSecret(null);
setConfirmed(true);
refreshUser().catch(() => {});
}}
onCancel={async () => {
await cancelCheckout().catch(() => {});