Merged in feat/SW-1308-booking-codes-track-b (pull request #1607)
Feat/SW-1308 booking codes track b * feat: SW-1308 Booking codes track b * feat: SW-1308 Booking codes Track B implementation * feat: SW-1308 Optimized after rebase Approved-by: Arvid Norlin
This commit is contained in:
@@ -6,7 +6,7 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
|
||||
import { ErrorCircleIcon } from "@/components/Icons"
|
||||
import { InfoCircleIcon } from "@/components/Icons"
|
||||
import Checkbox from "@/components/TempDesignSystem/Form/Checkbox"
|
||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||
|
||||
@@ -27,14 +27,13 @@ export default function RewardNight() {
|
||||
const ref = useRef<HTMLDivElement | null>(null)
|
||||
const reward = intl.formatMessage({ id: "Book Reward Night" })
|
||||
const redemptionErr = errors[REDEMPTION]
|
||||
const bookingCode = getValues("bookingCode.value")
|
||||
const isMultiRoomError = redemptionErr?.message?.indexOf("Multi-room") === 0
|
||||
const errorInfoColor = isMultiRoomError ? "red" : "blue"
|
||||
|
||||
function validateRedemption(value: boolean) {
|
||||
// Validate redemption as per the rules defined in the schema
|
||||
trigger(REDEMPTION)
|
||||
if (value && bookingCode) {
|
||||
if (value && getValues("bookingCode.value")) {
|
||||
setValue("bookingCode.flag", false)
|
||||
setValue("bookingCode.value", "", { shouldValidate: true })
|
||||
// Hide the notification popup after 5 seconds by re-triggering validation
|
||||
// This is kept consistent with location search field error notification timeout
|
||||
@@ -87,15 +86,8 @@ export default function RewardNight() {
|
||||
</Checkbox>
|
||||
{redemptionErr && (
|
||||
<div className={styles.errorContainer}>
|
||||
<Caption
|
||||
className={styles.error}
|
||||
type="regular"
|
||||
color={errorInfoColor}
|
||||
>
|
||||
<ErrorCircleIcon
|
||||
color={errorInfoColor}
|
||||
className={styles.errorIcon}
|
||||
/>
|
||||
<Caption className={styles.error} type="regular" color="blue">
|
||||
<InfoCircleIcon color="blue" className={styles.errorIcon} />
|
||||
{intl.formatMessage({ id: redemptionErr.message })}
|
||||
</Caption>
|
||||
{isMultiRoomError ? <RemoveExtraRooms /> : null}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
.error {
|
||||
display: flex;
|
||||
gap: var(--Spacing-x-half);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.errorIcon {
|
||||
|
||||
Reference in New Issue
Block a user