feat: refactor of my stay
This commit is contained in:
committed by
Simon.Emanuelsson
parent
b5deb84b33
commit
ec087a3d15
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
import { dt } from "@/lib/dt"
|
||||
import { useMyStayRoomDetailsStore } from "@/stores/my-stay/myStayRoomDetailsStore"
|
||||
import { useMyStayStore } from "@/stores/my-stay"
|
||||
|
||||
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
||||
|
||||
@@ -9,19 +9,17 @@ import { calculateTotalPrice, mapToPrice } from "./mapToPrice"
|
||||
import styles from "./priceDetails.module.css"
|
||||
|
||||
export default function PriceDetails() {
|
||||
const bookedRoom = useMyStayRoomDetailsStore((state) => state.bookedRoom)
|
||||
const linkedReservationRooms = useMyStayRoomDetailsStore(
|
||||
(state) => state.linkedReservationRooms
|
||||
)
|
||||
|
||||
const rooms = [bookedRoom, ...linkedReservationRooms]
|
||||
.filter((room) => !room.isCancelled)
|
||||
.map((room) => ({
|
||||
...room,
|
||||
breakfastIncluded: room.rateDefinition.breakfastIncluded,
|
||||
price: mapToPrice(room),
|
||||
roomType: room.roomName,
|
||||
}))
|
||||
const { bookedRoom, rooms } = useMyStayStore((state) => ({
|
||||
bookedRoom: state.bookedRoom,
|
||||
rooms: state.rooms
|
||||
.filter((room) => !room.isCancelled)
|
||||
.map((room) => ({
|
||||
...room,
|
||||
breakfastIncluded: room.rateDefinition.breakfastIncluded,
|
||||
price: mapToPrice(room),
|
||||
roomType: room.roomName,
|
||||
})),
|
||||
}))
|
||||
|
||||
const bookingCode =
|
||||
rooms.find((room) => room.bookingCode)?.bookingCode ?? undefined
|
||||
|
||||
Reference in New Issue
Block a user