66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { useEnterDetailsStore } from "@/stores/enter-details"
|
|
|
|
import { MagicWandIcon } from "@/components/Icons"
|
|
import Modal from "@/components/Modal"
|
|
import Button from "@/components/TempDesignSystem/Button"
|
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
|
import { formatPrice } from "@/utils/numberFormatting"
|
|
|
|
import styles from "./modal.module.css"
|
|
|
|
import type { Dispatch, SetStateAction } from "react"
|
|
|
|
export default function MemberPriceModal({
|
|
isOpen,
|
|
setIsOpen,
|
|
}: {
|
|
isOpen: boolean
|
|
setIsOpen: Dispatch<SetStateAction<boolean>>
|
|
}) {
|
|
const memberRate = useEnterDetailsStore((state) => state.roomRate.memberRate)
|
|
const intl = useIntl()
|
|
|
|
const memberPrice = memberRate?.localPrice ?? memberRate?.requestedPrice
|
|
|
|
return (
|
|
<Modal isOpen={isOpen} onToggle={setIsOpen}>
|
|
<div className={styles.modalContent}>
|
|
<div className={styles.innerModalContent}>
|
|
<MagicWandIcon width="265px" />
|
|
<Title as="h3" level="h1" textTransform="regular">
|
|
{intl.formatMessage({
|
|
id: "Member price activated",
|
|
})}
|
|
</Title>
|
|
|
|
{memberPrice && (
|
|
<span className={styles.newPrice}>
|
|
<Body>
|
|
{intl.formatMessage({
|
|
id: "The new price is",
|
|
})}
|
|
</Body>
|
|
<Subtitle type="two" color="red">
|
|
{formatPrice(
|
|
intl,
|
|
memberPrice.pricePerStay,
|
|
memberPrice.currency
|
|
)}
|
|
</Subtitle>
|
|
</span>
|
|
)}
|
|
</div>
|
|
<Button intent="primary" theme="base" onClick={() => setIsOpen(false)}>
|
|
{intl.formatMessage({ id: "OK" })}
|
|
</Button>
|
|
</div>
|
|
</Modal>
|
|
)
|
|
}
|