feat: refactor of my stay

This commit is contained in:
Simon Emanuelsson
2025-04-25 14:08:14 +02:00
committed by Simon.Emanuelsson
parent b5deb84b33
commit ec087a3d15
208 changed files with 5458 additions and 4569 deletions

View File

@@ -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