From 006a4a92b0470b61f14121c398cc8ce85e0a5e20 Mon Sep 17 00:00:00 2001 From: Fluffy Date: Fri, 17 May 2024 15:01:54 +0100 Subject: [PATCH] Update cart value on checkout when page is loading make checkout button less rounded --- front/src/pages/Checkout.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/front/src/pages/Checkout.svelte b/front/src/pages/Checkout.svelte index 05e8608..3121827 100644 --- a/front/src/pages/Checkout.svelte +++ b/front/src/pages/Checkout.svelte @@ -2,7 +2,7 @@ import { link } from "svelte-spa-router"; import { ArrowLeft, SealWarning, ArrowRight } from "phosphor-svelte"; - import { type Checkout } from '../lib/types'; + import { type CartItem, type Checkout } from '../lib/types'; import Cart from "../lib/cart"; const CheckoutData: Checkout = { @@ -22,8 +22,12 @@ $: emailValid = CheckoutData.personal.email.length > 1 $: phoneValid = isNaN(CheckoutData.personal.phone) - $: items = Cart.getEntries(); - $: totalPrice = Cart.getTotalPrice(); + let items: [string, CartItem][]; + let totalPrice: number; + Cart.subscribe(() => { + items = Cart.getEntries(); + totalPrice = Cart.getTotalPrice(); + }); let unavailableItems = false; Cart.getEntries().forEach(([_, item]) => { @@ -238,7 +242,7 @@ font-size: $font-size-p; text-decoration: none; - border-radius: $border-radius-circle; + border-radius: $border-radius-large; border: 0 solid transparent; background-color: $color-primary; color: $color-on-primary;