diff --git a/components/HotelReservation/HotelCard/index.tsx b/components/HotelReservation/HotelCard/index.tsx index d36ce0205..623990987 100644 --- a/components/HotelReservation/HotelCard/index.tsx +++ b/components/HotelReservation/HotelCard/index.tsx @@ -56,13 +56,10 @@ export default function HotelCard({ onMouseLeave={handleMouseLeave} >
- {hotelData.gallery && ( + {hotelData?.galleryImages && ( )}
diff --git a/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx b/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx index 8c4971f06..1d0fb8df7 100644 --- a/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx +++ b/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx @@ -29,13 +29,10 @@ export default function HotelInfoCard({ hotelData }: HotelInfoCardProps) { {hotelAttributes && (
- {hotelAttributes.gallery && ( + {hotelAttributes?.galleryImages && ( )} {hotelAttributes.ratings?.tripAdvisor && ( diff --git a/server/routers/hotels/output.ts b/server/routers/hotels/output.ts index 08553d882..32640cf62 100644 --- a/server/routers/hotels/output.ts +++ b/server/routers/hotels/output.ts @@ -449,6 +449,7 @@ export const getHotelDataSchema = z.object({ facilities.sort((a, b) => b.sortOrder - a.sortOrder) ), gallery: gallerySchema.optional(), + galleryImages: z.array(imageSchema).optional(), healthAndWellness: facilitySchema.optional(), healthFacilities: z.array(healthFacilitySchema), hotelContent: hotelContentSchema, diff --git a/server/routers/hotels/query.ts b/server/routers/hotels/query.ts index 192d88e33..4e195c856 100644 --- a/server/routers/hotels/query.ts +++ b/server/routers/hotels/query.ts @@ -60,6 +60,7 @@ import { FacilityCardTypeEnum } from "@/types/components/hotelPage/facilities" import type { BedTypeSelection } from "@/types/components/hotelReservation/enterDetails/bedType" import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" import { BreakfastPackageEnum } from "@/types/enums/breakfast" +import { HotelTypeEnum } from "@/types/enums/hotelType" import type { RequestOptionsWithOutBody } from "@/types/fetch" import type { Facility } from "@/types/hotel" import type { GetHotelPageData } from "@/types/trpc/routers/contentstack/hotelPage" @@ -257,13 +258,22 @@ export const getHotelData = cache( query: { hotelId, params: params }, }) ) + const hotelData = validateHotelData.data if (isCardOnlyPayment) { - validateHotelData.data.data.attributes.merchantInformationData.alternatePaymentOptions = + hotelData.data.attributes.merchantInformationData.alternatePaymentOptions = [] } + if (hotelData.data.attributes.gallery) { + const smallerImages = hotelData.data.attributes.gallery.smallerImages + const hotelGalleryImages = + hotelData.data.attributes.hotelType === HotelTypeEnum.Signature + ? smallerImages.slice(0, 10) + : smallerImages.slice(0, 6) + hotelData.data.attributes.galleryImages = hotelGalleryImages + } - return validateHotelData.data + return hotelData } ) diff --git a/types/enums/hotelType.ts b/types/enums/hotelType.ts new file mode 100644 index 000000000..00826f4a0 --- /dev/null +++ b/types/enums/hotelType.ts @@ -0,0 +1,5 @@ +export enum HotelTypeEnum { + Signature = "signature", + ScandicGo = "scandicgo", + Regular = "regular", +}