From 2f553bb945ffa6672550f77b71b43c5a52710710 Mon Sep 17 00:00:00 2001 From: Simon Emanuelsson Date: Tue, 10 Jun 2025 11:26:15 +0200 Subject: [PATCH] feat: change GLA to be more clear to the user --- .../Confirm/Guarantee/guarantee.module.css | 98 ++++++++++++ .../EnterDetails/Confirm/Guarantee/index.tsx | 140 ++++++++++++++++++ .../EnterDetails/Confirm/confirm.module.css | 52 +------ .../EnterDetails/Confirm/index.tsx | 123 ++------------- .../EnterDetails/Payment/PaymentClient.tsx | 36 +++-- .../Payment/TermsAndConditions/index.tsx | 22 ++- .../EnterDetails/Payment/payment.module.css | 6 + .../PaymentOption/paymentOption.module.css | 2 +- 8 files changed, 292 insertions(+), 187 deletions(-) create mode 100644 apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/guarantee.module.css create mode 100644 apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/guarantee.module.css b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/guarantee.module.css new file mode 100644 index 000000000..8538e1b22 --- /dev/null +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/guarantee.module.css @@ -0,0 +1,98 @@ +@keyframes overlay-fade { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +@keyframes modal-anim { + from { + transform: translateY(100%); + } + + to { + transform: translateY(0); + } +} + +.guarantee { + display: flex; + flex-direction: column; + gap: var(--Space-x1); +} + +.checkboxContainer { + align-items: center; + display: flex; + flex: 1; + gap: var(--Space-x1); + justify-content: space-between; +} + +.infoButton { + display: flex; + gap: var(--Space-x05); + justify-self: flex-end; + outline: none; +} + +.overlay { + align-items: center; + background-color: var(--Overlay-40); + display: flex; + inset: 0; + justify-content: center; + position: fixed; + z-index: var(--default-modal-overlay-z-index); + + &[data-entering] { + animation: overlay-fade 200ms; + } + + &[data-exiting] { + animation: overlay-fade 150ms reverse ease-in; + } +} + +.modal { + background-color: var(--Base-Surface-Primary-light-Normal); + border-radius: var(--Corner-radius-lg); + box-shadow: 0px 4px 24px 0px rgba(38, 32, 30, 0.08); + overflow: hidden; + padding: var(--Spacing-x5) var(--Spacing-x3); + width: min(90dvw, 560px); + + &[data-entering] { + animation: modal-anim 200ms; + } + + &[data-exiting] { + animation: modal-anim 150ms reverse ease-in; + } +} + +.container { + align-items: center; + display: flex; + flex-direction: column; + gap: var(--Spacing-x2); +} + +.text { + text-align: center; +} + +.closeButton { + margin-top: var(--Space-x15); + outline: none; + width: min(164px, 100%); +} + +@media screen and (max-width: 767px) { + .btnText { + display: none; + } +} diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx new file mode 100644 index 000000000..2bda79146 --- /dev/null +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx @@ -0,0 +1,140 @@ +"use client" +import { useLayoutEffect } from "react" +import { + Dialog, + DialogTrigger, + Modal, + ModalOverlay, +} from "react-aria-components" +import { useWatch } from "react-hook-form" +import { useIntl } from "react-intl" + +import { Button } from "@scandic-hotels/design-system/Button" +import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { Typography } from "@scandic-hotels/design-system/Typography" + +import { PaymentMethodEnum } from "@/constants/booking" + +import MySavedCards from "@/components/HotelReservation/MySavedCards" +import PaymentOption from "@/components/HotelReservation/PaymentOption" +import Checkbox from "@/components/TempDesignSystem/Form/Checkbox" +import useSetOverflowVisibleOnRA from "@/hooks/useSetOverflowVisibleOnRA" + +import PaymentOptionsGroup from "../../Payment/PaymentOptionsGroup" + +import styles from "./guarantee.module.css" + +import type { CreditCard } from "@/types/user" + +interface GuaranteeProps { + savedCreditCards: CreditCard[] | null +} + +export default function Guarantee({ savedCreditCards }: GuaranteeProps) { + const intl = useIntl() + const guarantee = useWatch({ name: "guarantee" }) + return ( +
+ +
+ + + {intl.formatMessage({ + defaultMessage: + "I may arrive later than 18:00 and want to guarantee my booking.", + })} + + + + + + + + {({ close }) => ( +
+ +

+ {intl.formatMessage({ + defaultMessage: "Guarantee for late arrival", + })} +

+
+ +

+ {intl.formatMessage({ + defaultMessage: + "When guaranteeing your booking with a credit card, we will hold the booking until 07:00 the day after check-in.", + })} +

+
+ +

+ {intl.formatMessage({ + defaultMessage: + "In case of a no-show, your credit card will be charged for the first night.", + })} +

+
+ + +
+ )} +
+
+
+
+
+
+ {savedCreditCards?.length && guarantee ? ( + + ) : null} + {guarantee ? ( + + + + ) : null} +
+ ) +} + +function RestoreOverflow() { + const setOverflowVisible = useSetOverflowVisibleOnRA() + useLayoutEffect(() => { + setOverflowVisible(true) + }, [setOverflowVisible]) + return null +} diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/confirm.module.css b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/confirm.module.css index ac5077656..642295320 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/confirm.module.css +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/confirm.module.css @@ -4,25 +4,13 @@ gap: var(--Spacing-x3); } -.title { - display: flex; - justify-content: space-between; - align-items: center; - padding: var(--Spacing-x-half); -} - -.guaranteeContainer { +.selections { + background-color: var(--Surface-Secondary-Default); + border-radius: var(--Corner-radius-Large); display: flex; flex-direction: column; - gap: var(--Spacing-x-one-and-half); - background-color: var(--Base-Surface-Primary-light-Normal); - border-radius: var(--Corner-radius-md); - padding: var(--Spacing-x-one-and-half) var(--Spacing-x2); - width: min(512px, 100%); -} -.checkbox { - display: flex; - gap: var(--Spacing-x-one-and-half); + gap: var(--Spacing-x2); + padding: var(--Spacing-x2); } .checkboxContainer { @@ -31,33 +19,3 @@ gap: var(--Spacing-x2); width: min(800px, 100%); } - -.modalContainer { - display: flex; - flex-direction: column; - gap: var(--Spacing-x2); - align-items: center; - width: 100%; -} - -.infoButton { - display: flex; - gap: var(--Space-x05); - outline: none; -} - -.modalText { - text-align: center; -} - -.closeButton { - margin-top: var(--Space-x15); - width: min(164px, 100%); - outline: none; -} - -@media screen and (min-width: 768px) { - .modalContainer { - width: 552px; - } -} diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/index.tsx index 7b3df1355..91af08656 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/index.tsx @@ -1,23 +1,13 @@ "use client" - -import { useState } from "react" -import { useFormContext } from "react-hook-form" import { useIntl } from "react-intl" -import { Button } from "@scandic-hotels/design-system/Button" import { Divider } from "@scandic-hotels/design-system/Divider" -import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { PaymentMethodEnum } from "@/constants/booking" - -import MySavedCards from "@/components/HotelReservation/MySavedCards" -import PaymentOption from "@/components/HotelReservation/PaymentOption" -import Modal from "@/components/Modal" import Checkbox from "@/components/TempDesignSystem/Form/Checkbox" -import PaymentOptionsGroup from "../Payment/PaymentOptionsGroup" import TermsAndConditions from "../Payment/TermsAndConditions" +import Guarantee from "./Guarantee" import styles from "./confirm.module.css" @@ -31,108 +21,21 @@ export default function ConfirmBooking({ savedCreditCards, }: ConfirmBookingProps) { const intl = useIntl() - const [isModalOpen, setModalOpen] = useState(false) - - const { watch } = useFormContext() - const guarantee = watch("guarantee") - return (
-
-
-
- - -

- {intl.formatMessage({ - defaultMessage: "Guarantee booking for late arrival", - })} -

-
-
- - - setModalOpen(false)}> -
- -

- {intl.formatMessage({ - defaultMessage: "Guarantee for late arrival", - })} -

-
- -

- {intl.formatMessage({ - defaultMessage: - "When guaranteeing your booking with a credit card, we will hold the booking until 07:00 the day after check-in.", - })} -

-
- -

- {intl.formatMessage({ - defaultMessage: - "In case of a no-show, your credit card will be charged for the first night.", - })} -

-
- -
-
-
- - -

- {intl.formatMessage({ - defaultMessage: - "I may arrive later than 18:00 and want to guarantee my booking with a credit card.", - })} -

-
- {savedCreditCards?.length && guarantee ? ( - - ) : null} - {guarantee ? ( - - + + + + + + {intl.formatMessage({ + defaultMessage: + "I would like to get my booking confirmation via sms", })} - /> - - ) : null} + + +
diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx index 8b5882c91..fa25c2793 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx @@ -26,8 +26,8 @@ import { trpc } from "@/lib/trpc/client" import { useEnterDetailsStore } from "@/stores/enter-details" import PaymentOption from "@/components/HotelReservation/PaymentOption" +import Checkbox from "@/components/TempDesignSystem/Form/Checkbox" import Body from "@/components/TempDesignSystem/Text/Body" -import Title from "@/components/TempDesignSystem/Text/Title" import { useAvailablePaymentOptions } from "@/hooks/booking/useAvailablePaymentOptions" import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus" import useLang from "@/hooks/useLang" @@ -482,14 +482,9 @@ export default function PaymentClient({ ] ) - const paymentGuarantee = intl.formatMessage({ - defaultMessage: "Payment Guarantee", - }) - const payment = intl.formatMessage({ - defaultMessage: "Payment", - }) - const confirm = intl.formatMessage({ - defaultMessage: "Confirm booking", + const finalStep = intl.formatMessage({ defaultMessage: "Final step" }) + const selectPayment = intl.formatMessage({ + defaultMessage: "Select payment method", }) return ( @@ -499,13 +494,9 @@ export default function PaymentClient({ })} >
- - {hasOnlyFlexRates && bookingMustBeGuaranteed - ? paymentGuarantee - : hasOnlyFlexRates - ? confirm - : payment} - + + {hasOnlyFlexRates ? finalStep : selectPayment} +
@@ -611,6 +602,19 @@ export default function PaymentClient({ ) : null} +
+ + + + {intl.formatMessage({ + defaultMessage: + "I would like to get my booking confirmation via sms", + })} + + + +
+
diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/TermsAndConditions/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/TermsAndConditions/index.tsx index 78608fa19..8e890eac7 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/TermsAndConditions/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/TermsAndConditions/index.tsx @@ -1,5 +1,7 @@ import { useIntl } from "react-intl" +import { Typography } from "@scandic-hotels/design-system/Typography" + import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" import Checkbox from "@/components/TempDesignSystem/Form/Checkbox" @@ -87,19 +89,13 @@ export default function TermsAndConditions({ )} - - {intl.formatMessage({ - defaultMessage: "I accept the terms and conditions", - })} - - - - - {intl.formatMessage({ - defaultMessage: - "I would like to get my booking confirmation via sms", - })} - + + + {intl.formatMessage({ + defaultMessage: "I accept the terms and conditions", + })} + + ) diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/payment.module.css b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/payment.module.css index c8ff72bf5..c96481e86 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/payment.module.css +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/payment.module.css @@ -43,6 +43,12 @@ gap: var(--Spacing-x-one-and-half); } +.checkboxContainer { + background-color: var(--Surface-Secondary-Default); + border-radius: var(--Corner-radius-Large); + padding: var(--Spacing-x2); +} + @media screen and (min-width: 1367px) { .submitButton { display: flex; diff --git a/apps/scandic-web/components/HotelReservation/PaymentOption/paymentOption.module.css b/apps/scandic-web/components/HotelReservation/PaymentOption/paymentOption.module.css index 78206dfce..d728fc4d3 100644 --- a/apps/scandic-web/components/HotelReservation/PaymentOption/paymentOption.module.css +++ b/apps/scandic-web/components/HotelReservation/PaymentOption/paymentOption.module.css @@ -1,7 +1,7 @@ .paymentOption { position: relative; background-color: var(--UI-Input-Controls-Surface-Normal); - padding: var(--Spacing-x3); + padding: var(--Space-x15) var(--Space-x2); border: 1px solid var(--Base-Border-Normal); border-radius: var(--Corner-radius-md); display: flex;