feat: SW-963 Optimized code

This commit is contained in:
Hrishikesh Vaipurkar
2025-03-05 17:13:13 +01:00
parent 561b121b54
commit 0e55c6ac6d

View File

@@ -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<HTMLDivElement | null>(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 (
<Button
value={intl.formatMessage({ id: "Remove extra rooms" })}
type="button"
onClick={removeExtraRooms}
size="small"