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

@@ -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) => {