Skip to content

Commit

Permalink
feat: notify on unsaved address
Browse files Browse the repository at this point in the history
  • Loading branch information
csandru-plenty committed Oct 28, 2024
1 parent 1621b03 commit d96af43
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions apps/web/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@
"saveAddress": "Adresse speichern",
"savedBillingAddress": "Gespeicherte Rechnungsadressen",
"savedShippingAddress": "Gespeicherte Lieferadressen",
"unsavedAddress": "Sie haben eine Adresse die nicht gespeichert wurde",
"scrollTop": "Nach oben scrollen",
"search": "Suche",
"shipping": {
Expand Down
1 change: 1 addition & 0 deletions apps/web/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@
"saveAddress": "Save address",
"savedBillingAddress": "Saved billing adresses",
"savedShippingAddress": "Saved shipping adresses",
"unsavedAddress": "You have an Address that has not been saved",
"scrollTop": "Scroll to top",
"search": "Search",
"shipping": {
Expand Down
18 changes: 12 additions & 6 deletions apps/web/pages/checkout.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<NuxtLayout
name="checkout"
:back-label-desktop="$t('backToCart')"
:back-label-mobile="$t('back')"
:heading="$t('checkout')"
:back-label-desktop="t('backToCart')"
:back-label-mobile="t('back')"
:heading="t('checkout')"
>
<div v-if="cart" class="lg:grid lg:grid-cols-12 lg:gap-x-6">
<div class="col-span-6 xl:col-span-7 mb-10 lg:mb-0">
Expand Down Expand Up @@ -64,7 +64,7 @@
size="lg"
class="w-full mb-4 md:mb-0 cursor-pointer"
>
{{ $t('buy') }}
{{ t('buy') }}
</UiButton>
<UiButton
v-else
Expand All @@ -76,7 +76,7 @@
class="w-full mb-4 md:mb-0 cursor-pointer"
>
<SfLoaderCircular v-if="createOrderLoading" class="flex justify-center items-center" size="sm" />
<template v-else>{{ $t('buy') }}</template>
<template v-else>{{ t('buy') }}</template>
</UiButton>
<!-- <PayPalApplePayButton
v-if="applePayAvailable"
Expand Down Expand Up @@ -112,6 +112,8 @@ definePageMeta({
pageType: 'static',
});
const { send } = useNotification();
const { t } = useI18n();
const localePath = useLocalePath();
const { loading: createOrderLoading, createOrder } = useMakeOrder();
const { shippingPrivacyAgreement } = useAdditionalInformation();
Expand Down Expand Up @@ -177,7 +179,11 @@ const paypalCreditCardPaymentId = computed(() => {
// const applePayAvailable = computed(() => import.meta.client && (window as any).ApplePaySession);
const readyToBuy = () => {
if (anyAddressFormIsOpen.value) return backToFormEditing();
if (anyAddressFormIsOpen.value) {
send({ type: 'secondary', message: t('unsavedAddress') });
return backToFormEditing();
}
return !(!validateTerms() || !hasShippingAddress.value || !hasBillingAddress.value);
};
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/changelog_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### New

- Clicking "Buy" with an unsaved Address will now display a notification.
- Added a new request header for configId and added no cache to environment variables.
- Implement new notification design
- Adding the ability to have alt text for images.
Expand Down

0 comments on commit d96af43

Please sign in to comment.