feat: SW-2079 Show points in confirmation page * feat: SW-2079 Show points in confirmation page * feat: SW-2079 Optimized code * feat: SW-2079 Updated Body to Typography * feat: SW-2079 Multi-room total cost display * feat: SW-2079 Add reward nights condition rate title * feat: SW-2079 Removed extra checks * feat: SW-2079 Optimmized formatPrice function * feat: SW-2079 Typo fix Approved-by: Christian Andolf
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
|
|
|
import SkeletonShimmer from "@/components/SkeletonShimmer"
|
|
import Divider from "@/components/TempDesignSystem/Divider"
|
|
|
|
import PriceDetailsModal from "../../PriceDetailsModal"
|
|
|
|
import styles from "./totalPrice.module.css"
|
|
|
|
export default function TotalPrice() {
|
|
const intl = useIntl()
|
|
const { rooms, formattedTotalCost } = useBookingConfirmationStore(
|
|
(state) => ({
|
|
rooms: state.rooms,
|
|
formattedTotalCost: state.formattedTotalCost,
|
|
})
|
|
)
|
|
|
|
const hasAllRoomsLoaded = rooms.every((room) => room)
|
|
|
|
return (
|
|
<>
|
|
<Divider color="primaryLightSubtle" />
|
|
<div className={styles.price}>
|
|
<div className={styles.entry}>
|
|
<Typography variant="Body/Paragraph/mdBold">
|
|
<p>{intl.formatMessage({ id: "Total price" })}</p>
|
|
</Typography>
|
|
{hasAllRoomsLoaded ? (
|
|
<Typography variant="Body/Paragraph/mdBold">
|
|
<p>{formattedTotalCost}</p>
|
|
</Typography>
|
|
) : (
|
|
<SkeletonShimmer width={"25%"} />
|
|
)}
|
|
</div>
|
|
{hasAllRoomsLoaded ? (
|
|
<PriceDetailsModal />
|
|
) : (
|
|
<div className={styles.priceDetailsLoader}>
|
|
<SkeletonShimmer width={"100%"} />
|
|
</div>
|
|
)}
|
|
</div>
|
|
</>
|
|
)
|
|
}
|