feat: SW-2028 Fixed review comments

This commit is contained in:
Hrishikesh Vaipurkar
2025-03-31 16:35:52 +02:00
parent 4e9ee82efa
commit 96fd0b73e4
14 changed files with 214 additions and 195 deletions

View File

@@ -5,6 +5,7 @@ import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDet
import type { RoomPrice } from "@/types/components/hotelReservation/enterDetails/details"
import type { PriceType } from "@/types/components/hotelReservation/myStay/myStay"
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import { CurrencyEnum } from "@/types/enums/currency"
import type { Packages } from "@/types/requests/packages"
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
@@ -73,7 +74,7 @@ export const useMyStayRoomDetailsStore = create<MyStayRoomDetailsState>(
bookingCode: null,
cheques: 0,
vouchers: 0,
currencyCode: "",
currencyCode: CurrencyEnum.Unknown,
guest: {
email: "",
firstName: "",
@@ -97,21 +98,21 @@ export const useMyStayRoomDetailsStore = create<MyStayRoomDetailsState>(
perNight: {
requested: {
price: 0,
currency: "",
currency: CurrencyEnum.Unknown,
},
local: {
price: 0,
currency: "",
currency: CurrencyEnum.Unknown,
},
},
perStay: {
requested: {
price: 0,
currency: "",
currency: CurrencyEnum.Unknown,
},
local: {
price: 0,
currency: "",
currency: CurrencyEnum.Unknown,
},
},
},

View File

@@ -1,9 +1,11 @@
import { create } from "zustand"
import { CurrencyEnum } from "@/types/enums/currency"
interface RoomPrice {
id: string
totalPrice: number
currencyCode: string
currencyCode: CurrencyEnum
isMainBooking?: boolean
roomPoints: number
}
@@ -11,7 +13,7 @@ interface RoomPrice {
interface MyStayTotalPriceState {
rooms: RoomPrice[]
totalPrice: number | null
currencyCode: string
currencyCode: CurrencyEnum
totalPoints: number
actions: {
// Add a single room price
@@ -26,7 +28,7 @@ export const useMyStayTotalPriceStore = create<MyStayTotalPriceState>(
totalPoints: 0,
totalCheques: 0,
totalVouchers: 0,
currencyCode: "",
currencyCode: CurrencyEnum.Unknown,
actions: {
addRoomPrice: (room) => {
set((state) => {
@@ -44,7 +46,7 @@ export const useMyStayTotalPriceStore = create<MyStayTotalPriceState>(
// Get currency from main booking or first room
const mainRoom = newRooms.find((r) => r.isMainBooking) || newRooms[0]
const currencyCode = mainRoom?.currencyCode || ""
const currencyCode = mainRoom?.currencyCode ?? CurrencyEnum.Unknown
// Calculate total (only same currency for now)
const total = newRooms.reduce((sum, r) => {