chore: cleaning up select-rate

This commit is contained in:
Simon Emanuelsson
2025-02-05 20:18:03 +01:00
parent 3044bc87d1
commit 051bc54e6c
95 changed files with 3269 additions and 3527 deletions

View File

@@ -0,0 +1,15 @@
import type { CreditCard, SafeUser } from "@/types/user"
import type { PaymentMethodEnum } from "@/constants/booking"
import type { Child } from "../selectRate/selectRate"
export interface PaymentProps {
user: SafeUser
otherPaymentOptions: PaymentMethodEnum[]
mustBeGuaranteed: boolean
supportedCards: PaymentMethodEnum[]
}
export interface PaymentClientProps
extends Omit<PaymentProps, "supportedCards"> {
savedCreditCards: CreditCard[] | null
}

View File

@@ -14,17 +14,14 @@ type ProductPrice = z.output<typeof productTypePriceSchema>
export type RoomPriceSchema = z.output<typeof priceSchema>
export type FlexibilityOptionProps = {
handleSelect: (
rateCode: string,
rateName: string,
paymentTerm: string
) => void
features: RoomConfiguration["features"]
isSelected: boolean
isUserLoggedIn: boolean
paymentTerm: string
petRoomPackage: RoomPackage | undefined
priceInformation?: Array<string>
product: Product | undefined
roomType: RoomConfiguration["roomType"]
roomTypeCode: RoomConfiguration["roomTypeCode"]
title: string
}

View File

@@ -1,21 +1,11 @@
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
import type { Price } from "../price"
import type { RoomPackages } from "./roomFilter"
import type { SelectRateSearchParams } from "./selectRate"
export interface RateSummaryProps {
isUserLoggedIn: boolean
packages: RoomPackages | undefined
roomsAvailability: RoomsAvailability
booking: SelectRateSearchParams
vat: number
}
export interface MobileSummaryProps {
totalPriceToShow: Price
export interface MobileSummaryProps extends RateSummaryProps {
isAllRoomsSelected: boolean
booking: SelectRateSearchParams
isUserLoggedIn: boolean
vat: number
roomsAvailability: RoomsAvailability
totalPriceToShow: Price
}

View File

@@ -1,23 +1,11 @@
import type { z } from "zod"
import type { Room } from "@/types/hotel"
import type {
RateDefinition,
RoomConfiguration,
} from "@/types/trpc/routers/hotel/roomAvailability"
import type { RoomConfiguration } from "@/types/trpc/routers/hotel/roomAvailability"
import type { packagePriceSchema } from "@/server/routers/hotels/schemas/packages"
import type { RoomPriceSchema } from "./flexibilityOption"
import type { RoomPackageCodes, RoomPackages } from "./roomFilter"
export type RoomCardProps = {
hotelId: string
hotelType: string | undefined
roomConfiguration: RoomConfiguration
rateDefinitions: RateDefinition[]
roomCategories: Room[]
selectedPackages: RoomPackageCodes[]
roomListIndex: number
packages: RoomPackages | undefined
}
type RoomPackagePriceSchema = z.output<typeof packagePriceSchema>
@@ -31,3 +19,12 @@ export type CalculatePricesPerNightProps = {
petRoomRequestedPrice?: RoomPackagePriceSchema
nights: number
}
export interface RoomSizeProps {
roomSize:
| {
max: number
min: number
}
| undefined
}

View File

@@ -17,12 +17,6 @@ export interface DefaultFilterOptions {
export type FilterValues = {
[K in RoomPackageCodeEnum]?: boolean
}
export interface RoomFilterProps {
numberOfRooms: number
filterOptions: DefaultFilterOptions[]
initialFilterValues: FilterValues
roomListIndex: number
}
export type RoomPackage = z.output<typeof packageSchema>
export type RoomPackageCodes = RoomPackage["code"]

View File

@@ -1,19 +1,6 @@
import type { Room } from "@/types/hotel"
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
import type {
DefaultFilterOptions,
RoomPackageCodes,
RoomPackages,
} from "./roomFilter"
export interface RoomTypeListProps {
availablePackages: RoomPackages | undefined
hotelType: string | undefined
roomCategories: Room[]
roomListIndex: number
roomsAvailability: RoomsAvailability
selectedPackages: RoomPackageCodes[]
}
import type { RoomPackageCodes, RoomPackages } from "./roomFilter"
export interface SelectRateProps {
availablePackages: RoomPackages
@@ -23,12 +10,3 @@ export interface SelectRateProps {
roomCategories: Room[]
vat: number
}
export interface RoomSelectionPanelProps {
availablePackages: RoomPackages
defaultPackages: DefaultFilterOptions[]
hotelType: string | undefined
roomCategories: Room[]
roomListIndex: number
selectedPackages: RoomPackageCodes[]
}

View File

@@ -1,55 +0,0 @@
import type { CreditCard, SafeUser } from "@/types/user"
import type { PaymentMethodEnum } from "@/constants/booking"
import type { Child } from "./selectRate"
export interface SectionProps {
nextPath: string
}
export interface BedSelectionProps extends SectionProps {
alternatives: {
value: string
name: string
payment: string
pricePerNight: number
membersPricePerNight: number
currency: string
}[]
}
export interface BreakfastSelectionProps extends SectionProps {
alternatives: {
value: string
name: string
payment: string
pricePerNight: number
currency: string
}[]
}
export interface DetailsProps extends SectionProps {}
export interface PaymentProps {
user: SafeUser
otherPaymentOptions: PaymentMethodEnum[]
mustBeGuaranteed: boolean
supportedCards: PaymentMethodEnum[]
}
export interface PaymentClientProps
extends Omit<PaymentProps, "supportedCards"> {
savedCreditCards: CreditCard[] | null
}
export interface RoomParam {
adults: number
children?: Child[]
}
export interface SectionPageProps {
breakfast?: string
bed?: string
fromDate: string
toDate: string
room: RoomParam[]
}

View File

@@ -12,31 +12,35 @@ export interface Child {
export interface Room {
adults: number
roomTypeCode: string
rateCode: string
counterRateCode: string
childrenInRoom?: Child[]
counterRateCode: string
packages?: RoomPackageCodeEnum[]
rateCode: string
roomTypeCode: string
}
export interface SelectRateSearchParams {
city?: string
hotelId: string
fromDate: string
toDate: string
rooms: Room[]
bookingCode?: string
city?: string
fromDate: string
hotelId: string
rooms: Room[]
toDate: string
}
export interface Rate {
roomType: RoomConfiguration["roomType"]
roomTypeCode: RoomConfiguration["roomTypeCode"]
features: RoomConfiguration["features"]
member?: Product["productType"]["member"]
package?: RoomPackageCodeEnum | undefined
priceName?: string
priceTerm?: string
public: Product["productType"]["public"]
member?: Product["productType"]["member"]
features: RoomConfiguration["features"]
roomRates?: Array<{ roomIndex: number; rate: Rate }>
roomRates?: {
rate: Rate
roomIndex: number
}[]
roomType: RoomConfiguration["roomType"]
roomTypeCode: RoomConfiguration["roomTypeCode"]
}
export type RateCode = {

View File

@@ -1,7 +0,0 @@
export type SelectionCardProps = {
title: string
subtext: string
price: number
membersPrice?: number
currency: string
}

View File

@@ -24,7 +24,6 @@ export interface SummaryUIProps {
isMember: boolean
totalPrice: Price
toggleSummaryOpen: () => void
togglePriceDetailsModalOpen: () => void
vat: number
}