From a0c2d0bef797d53ae11f49e9cfa37836a24ca969 Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Tue, 3 Dec 2024 15:16:33 +0100 Subject: [PATCH] fix(SW-1042): fix comment --- .../HotelReservation/SelectRate/Rooms/index.tsx | 17 +++++++---------- .../selectRate/flexibilityOption.ts | 14 +++----------- .../hotelReservation/selectRate/roomCard.ts | 14 ++------------ .../selectRate/roomSelection.ts | 14 ++------------ .../hotelReservation/selectRate/selectRate.ts | 7 +++++++ 5 files changed, 21 insertions(+), 45 deletions(-) diff --git a/components/HotelReservation/SelectRate/Rooms/index.tsx b/components/HotelReservation/SelectRate/Rooms/index.tsx index ee1758b47..584e0195a 100644 --- a/components/HotelReservation/SelectRate/Rooms/index.tsx +++ b/components/HotelReservation/SelectRate/Rooms/index.tsx @@ -14,7 +14,10 @@ import { type RoomPackageCodes, } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { SelectRateProps } from "@/types/components/hotelReservation/selectRate/roomSelection" -import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate" +import type { + Rate, + RateCode, +} from "@/types/components/hotelReservation/selectRate/selectRate" import type { RoomConfiguration } from "@/server/routers/hotels/output" export default function Rooms({ @@ -25,15 +28,9 @@ export default function Rooms({ }: SelectRateProps) { const visibleRooms: RoomConfiguration[] = filterDuplicateRoomTypesByLowestPrice(roomsAvailability.roomConfigurations) - const [selectedRate, setSelectedRate] = useState< - | { - publicRateCode: string - roomTypeCode: string - name: string - paymentTerm: string - } - | undefined - >(undefined) + const [selectedRate, setSelectedRate] = useState( + undefined + ) const [selectedPackages, setSelectedPackages] = useState( [] ) diff --git a/types/components/hotelReservation/selectRate/flexibilityOption.ts b/types/components/hotelReservation/selectRate/flexibilityOption.ts index a4f185654..eb1b2383d 100644 --- a/types/components/hotelReservation/selectRate/flexibilityOption.ts +++ b/types/components/hotelReservation/selectRate/flexibilityOption.ts @@ -9,6 +9,8 @@ import { import { RoomPackage } from "./roomFilter" +import type { RateCode } from "./selectRate" + type ProductPrice = z.output export type RoomPriceSchema = z.output @@ -20,17 +22,7 @@ export type FlexibilityOptionProps = { priceInformation?: Array roomTypeCode: RoomConfiguration["roomTypeCode"] petRoomPackage: RoomPackage | undefined - handleSelectRate: React.Dispatch< - React.SetStateAction< - | { - publicRateCode: string - roomTypeCode: string - name: string - paymentTerm: string - } - | undefined - > - > + handleSelectRate: React.Dispatch> } export interface PriceListProps { diff --git a/types/components/hotelReservation/selectRate/roomCard.ts b/types/components/hotelReservation/selectRate/roomCard.ts index 27cdf67ec..41f0391e6 100644 --- a/types/components/hotelReservation/selectRate/roomCard.ts +++ b/types/components/hotelReservation/selectRate/roomCard.ts @@ -7,10 +7,10 @@ import { } from "@/server/routers/hotels/output" import { RoomPriceSchema } from "./flexibilityOption" -import { Rate } from "./selectRate" import type { RoomData } from "@/types/hotel" import type { RoomPackageCodes, RoomPackageData } from "./roomFilter" +import type { RateCode } from "./selectRate" export type RoomCardProps = { hotelId: string @@ -19,17 +19,7 @@ export type RoomCardProps = { roomCategories: RoomData[] selectedPackages: RoomPackageCodes[] packages: RoomPackageData | undefined - handleSelectRate: React.Dispatch< - React.SetStateAction< - | { - publicRateCode: string - roomTypeCode: string - name: string - paymentTerm: string - } - | undefined - > - > + handleSelectRate: React.Dispatch> } type RoomPackagePriceSchema = z.output diff --git a/types/components/hotelReservation/selectRate/roomSelection.ts b/types/components/hotelReservation/selectRate/roomSelection.ts index c91fe6725..31781dfc2 100644 --- a/types/components/hotelReservation/selectRate/roomSelection.ts +++ b/types/components/hotelReservation/selectRate/roomSelection.ts @@ -2,7 +2,7 @@ import type { RoomData } from "@/types/hotel" import type { SafeUser } from "@/types/user" import type { RoomsAvailability } from "@/server/routers/hotels/output" import type { RoomPackageCodes, RoomPackageData } from "./roomFilter" -import type { Rate } from "./selectRate" +import type { Rate, RateCode } from "./selectRate" export interface RoomSelectionProps { roomsAvailability: RoomsAvailability @@ -10,17 +10,7 @@ export interface RoomSelectionProps { user: SafeUser availablePackages: RoomPackageData | undefined selectedPackages: RoomPackageCodes[] - setRateCode: React.Dispatch< - React.SetStateAction< - | { - publicRateCode: string - roomTypeCode: string - name: string - paymentTerm: string - } - | undefined - > - > + setRateCode: React.Dispatch> rateSummary: Rate | null } diff --git a/types/components/hotelReservation/selectRate/selectRate.ts b/types/components/hotelReservation/selectRate/selectRate.ts index 7a1fb89bb..5be51cf20 100644 --- a/types/components/hotelReservation/selectRate/selectRate.ts +++ b/types/components/hotelReservation/selectRate/selectRate.ts @@ -33,3 +33,10 @@ export interface Rate { member?: Product["productType"]["member"] features: RoomConfiguration["features"] } + +export type RateCode = { + publicRateCode: string + roomTypeCode: string + name: string + paymentTerm: string +}