Cart fixes (backend), adjusted header, added footer, mobile formatting updates

This commit is contained in:
augmentedpotato
2026-04-14 05:24:40 -06:00
parent 8e205ebca2
commit 7bddd74a6e
13 changed files with 769 additions and 107 deletions

View File

@@ -85,6 +85,7 @@ export default function CartPage() {
clearCart,
applyCoupon,
checkout,
cancelCheckout,
} = useCart();
const router = useRouter();
@@ -114,6 +115,14 @@ export default function CartPage() {
}
}, [cart]);
// If the cart arrives already locked (e.g. user closed the page mid-checkout)
// and there is no active Stripe session, release the lock automatically.
useEffect(() => {
if (cart?.checkoutPending && !clientSecret) {
cancelCheckout().catch(() => {});
}
}, [cart?.checkoutPending, clientSecret, cancelCheckout]);
async function handleQuantityChange(cartItemId, newQty) {
if (newQty < 1) {
return;
@@ -351,7 +360,10 @@ export default function CartPage() {
setClientSecret(null);
setConfirmed(true);
}}
onCancel={() => setClientSecret(null)}
onCancel={async () => {
await cancelCheckout().catch(() => {});
setClientSecret(null);
}}
/>
</Elements>
)}