From 0e55c6ac6d5eb0e19b89c1854edad12e42790542 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Wed, 5 Mar 2025 17:13:13 +0100 Subject: [PATCH] feat: SW-963 Optimized code --- .../Forms/BookingWidget/FormContent/BookingCode/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx index 49b8a3513..409301a6a 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx @@ -44,6 +44,7 @@ export default function BookingCode() { const codeVoucher = intl.formatMessage({ id: "Code / Voucher" }) const addCode = intl.formatMessage({ id: "Add code" }) const ref = useRef(null) + const removeExtraRoomsText = intl.formatMessage({ id: "Remove extra rooms" }) function updateBookingCodeFormValue(value: string) { setValue("bookingCode.value", value, { shouldValidate: true }) @@ -56,8 +57,7 @@ export default function BookingCode() { target && !ref.current.contains(target) && // This is for mobile layout having "Remove extra rooms" button outside the container - target.getAttribute("value") !== - intl.formatMessage({ id: "Remove extra rooms" }) + target.innerText !== removeExtraRoomsText ) { setShowRemember(false) if (codeError) { @@ -65,7 +65,7 @@ export default function BookingCode() { } } }, - [setShowRemember, setValue, intl, ref, codeError] + [setShowRemember, setValue, removeExtraRoomsText, ref, codeError] ) function showRememberCheck() { @@ -262,7 +262,6 @@ export function RemoveExtraRooms({ ...props }: ButtonProps) { return (