Merged in feat/sw-1493-revised-comparison-block (pull request #1236)
feat(SW-1493): Revised SAS comparison block * Base of new TierDetails for SAS tier comparison * Add backgrounds and content to TierDetails * Implement new cms schema for SasTierComparison * Override gap in jsontohtml styling to 0 * Add animations to comparison details * Redesign again * Update content model to new design * Add border to bottom item in tier match list * Wrap interpolate-size in @supports to be safe * Merge branch 'master' into feat/sw-1493-revised-comparison-block Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -22,34 +22,19 @@ export const sasTierComparisonSchema = z.object({
|
||||
node: z.object({
|
||||
title: z.string(),
|
||||
preamble: z.string().optional(),
|
||||
scandic_friends: z.object({
|
||||
title: z.string(),
|
||||
label: z.string(),
|
||||
tiers: z.array(
|
||||
z.object({
|
||||
tier_code: z.nativeEnum(MembershipLevelEnum),
|
||||
tier_label: z.string(),
|
||||
})
|
||||
),
|
||||
read_more_link: link.optional(),
|
||||
}),
|
||||
sas_eb: z.object({
|
||||
title: z.string(),
|
||||
label: z.string(),
|
||||
tiers: z.array(
|
||||
z.object({
|
||||
tier_code: z.enum([
|
||||
"Basic",
|
||||
"Silver",
|
||||
"Gold",
|
||||
"Diamond",
|
||||
"Pandion",
|
||||
]),
|
||||
tier_label: z.string(),
|
||||
})
|
||||
),
|
||||
read_more_link: link.optional(),
|
||||
}),
|
||||
scandic_column_title: z.string(),
|
||||
sas_column_title: z.string(),
|
||||
tier_matches: z.array(
|
||||
z.object({
|
||||
scandic_friends_tier_name: z.string(),
|
||||
sas_eb_tier_name: z.string(),
|
||||
title: z.string(),
|
||||
content: z.object({
|
||||
json: z.any(), // json
|
||||
}),
|
||||
link: link.optional(),
|
||||
})
|
||||
),
|
||||
cta: link.optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -73,7 +73,7 @@ export const getHotelsInput = z.object({
|
||||
.nullable(),
|
||||
hotelsToInclude: z.array(z.string()),
|
||||
})
|
||||
export interface GetHotelsInput extends z.infer<typeof getHotelsInput> { }
|
||||
export interface GetHotelsInput extends z.infer<typeof getHotelsInput> {}
|
||||
|
||||
export const nearbyHotelIdsInput = z.object({
|
||||
hotelId: z.string(),
|
||||
|
||||
@@ -34,8 +34,12 @@ export const metrics = {
|
||||
},
|
||||
hotelsByHotelIdAvailability: {
|
||||
counter: meter.createCounter("trpc.hotel.availability.hotels-by-hotel-id"),
|
||||
fail: meter.createCounter("trpc.hotel.availability.hotels-by-hotel-id-fail"),
|
||||
success: meter.createCounter("trpc.hotel.availability.hotels-by-hotel-id-success"),
|
||||
fail: meter.createCounter(
|
||||
"trpc.hotel.availability.hotels-by-hotel-id-fail"
|
||||
),
|
||||
success: meter.createCounter(
|
||||
"trpc.hotel.availability.hotels-by-hotel-id-success"
|
||||
),
|
||||
},
|
||||
meetingRooms: {
|
||||
counter: meter.createCounter("trpc.hotels.meetingRooms"),
|
||||
|
||||
@@ -34,32 +34,31 @@ export const extraPageSchema = z.object({
|
||||
mainBody: z.string().optional(),
|
||||
})
|
||||
|
||||
export const additionalDataSchema = z
|
||||
.object({
|
||||
attributes: z.object({
|
||||
name: z.string(),
|
||||
id: z.string(),
|
||||
displayWebPage: z.object({
|
||||
healthGym: z.boolean(),
|
||||
meetingRoom: z.boolean(),
|
||||
parking: z.boolean(),
|
||||
specialNeeds: z.boolean(),
|
||||
}),
|
||||
specialNeedGroups: z.array(specialNeedGroupSchema),
|
||||
gallery: gallerySchema.optional(),
|
||||
conferencesAndMeetings: facilitySchema.optional(),
|
||||
healthAndWellness: facilitySchema.optional(),
|
||||
restaurantImages: facilitySchema.optional(),
|
||||
restaurantsOverviewPage: restaurantsOverviewPageSchema,
|
||||
meetingRooms: extraPageSchema,
|
||||
healthAndFitness: extraPageSchema,
|
||||
hotelParking: extraPageSchema,
|
||||
hotelSpecialNeeds: extraPageSchema,
|
||||
accessibilityElevatorPitchText: z.string().optional(),
|
||||
hotelRoomElevatorPitchText: z.string().optional(),
|
||||
export const additionalDataSchema = z.object({
|
||||
attributes: z.object({
|
||||
name: z.string(),
|
||||
id: z.string(),
|
||||
displayWebPage: z.object({
|
||||
healthGym: z.boolean(),
|
||||
meetingRoom: z.boolean(),
|
||||
parking: z.boolean(),
|
||||
specialNeeds: z.boolean(),
|
||||
}),
|
||||
type: z.literal("additionalData"),
|
||||
})
|
||||
specialNeedGroups: z.array(specialNeedGroupSchema),
|
||||
gallery: gallerySchema.optional(),
|
||||
conferencesAndMeetings: facilitySchema.optional(),
|
||||
healthAndWellness: facilitySchema.optional(),
|
||||
restaurantImages: facilitySchema.optional(),
|
||||
restaurantsOverviewPage: restaurantsOverviewPageSchema,
|
||||
meetingRooms: extraPageSchema,
|
||||
healthAndFitness: extraPageSchema,
|
||||
hotelParking: extraPageSchema,
|
||||
hotelSpecialNeeds: extraPageSchema,
|
||||
accessibilityElevatorPitchText: z.string().optional(),
|
||||
hotelRoomElevatorPitchText: z.string().optional(),
|
||||
}),
|
||||
type: z.literal("additionalData"),
|
||||
})
|
||||
|
||||
export function transformAdditionalData(
|
||||
data: z.output<typeof additionalDataSchema>
|
||||
@@ -67,6 +66,6 @@ export function transformAdditionalData(
|
||||
return {
|
||||
...data.attributes,
|
||||
id: data.attributes.id,
|
||||
type: data.type
|
||||
type: data.type,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ import {
|
||||
roomCategoriesSchema,
|
||||
transformRoomCategories,
|
||||
} from "@/server/routers/hotels/schemas/hotel/include/roomCategories"
|
||||
import { additionalDataSchema, transformAdditionalData } from "../../additionalData"
|
||||
|
||||
import {
|
||||
additionalDataSchema,
|
||||
transformAdditionalData,
|
||||
} from "../../additionalData"
|
||||
|
||||
export const includeSchema = z
|
||||
.discriminatedUnion("type", [
|
||||
|
||||
@@ -86,12 +86,12 @@ export function transformRoomCategories(
|
||||
totalOccupancy:
|
||||
data.attributes.occupancy.min === data.attributes.occupancy.max
|
||||
? {
|
||||
max: data.attributes.occupancy.max,
|
||||
range: `${data.attributes.occupancy.max}`,
|
||||
}
|
||||
max: data.attributes.occupancy.max,
|
||||
range: `${data.attributes.occupancy.max}`,
|
||||
}
|
||||
: {
|
||||
max: data.attributes.occupancy.max,
|
||||
range: `${data.attributes.occupancy.min}-${data.attributes.occupancy.max}`,
|
||||
},
|
||||
max: data.attributes.occupancy.max,
|
||||
range: `${data.attributes.occupancy.min}-${data.attributes.occupancy.max}`,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,49 +2,48 @@ import { z } from "zod"
|
||||
|
||||
import { imageSchema } from "./image"
|
||||
|
||||
export const meetingRoomsSchema = z
|
||||
.object({
|
||||
data: z.array(
|
||||
z.object({
|
||||
attributes: z.object({
|
||||
name: z.string(),
|
||||
email: z.string().optional(),
|
||||
phoneNumber: z.string(),
|
||||
size: z.number(),
|
||||
doorWidth: z.number(),
|
||||
doorHeight: z.number(),
|
||||
length: z.number(),
|
||||
width: z.number(),
|
||||
height: z.number(),
|
||||
floorNumber: z.number(),
|
||||
content: z.object({
|
||||
images: z.array(imageSchema),
|
||||
texts: z.object({
|
||||
facilityInformation: z.string().optional(),
|
||||
surroundingInformation: z.string().optional(),
|
||||
descriptions: z.object({
|
||||
export const meetingRoomsSchema = z.object({
|
||||
data: z.array(
|
||||
z.object({
|
||||
attributes: z.object({
|
||||
name: z.string(),
|
||||
email: z.string().optional(),
|
||||
phoneNumber: z.string(),
|
||||
size: z.number(),
|
||||
doorWidth: z.number(),
|
||||
doorHeight: z.number(),
|
||||
length: z.number(),
|
||||
width: z.number(),
|
||||
height: z.number(),
|
||||
floorNumber: z.number(),
|
||||
content: z.object({
|
||||
images: z.array(imageSchema),
|
||||
texts: z.object({
|
||||
facilityInformation: z.string().optional(),
|
||||
surroundingInformation: z.string().optional(),
|
||||
descriptions: z.object({
|
||||
short: z.string().optional(),
|
||||
medium: z.string().optional(),
|
||||
}),
|
||||
meetingDescription: z
|
||||
.object({
|
||||
short: z.string().optional(),
|
||||
medium: z.string().optional(),
|
||||
}),
|
||||
meetingDescription: z
|
||||
.object({
|
||||
short: z.string().optional(),
|
||||
medium: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
}),
|
||||
})
|
||||
.optional(),
|
||||
}),
|
||||
seatings: z.array(
|
||||
z.object({
|
||||
type: z.string(),
|
||||
capacity: z.number(),
|
||||
})
|
||||
),
|
||||
lighting: z.string(),
|
||||
sortOrder: z.number().optional(),
|
||||
}),
|
||||
id: z.string(),
|
||||
type: z.string(),
|
||||
})
|
||||
),
|
||||
})
|
||||
seatings: z.array(
|
||||
z.object({
|
||||
type: z.string(),
|
||||
capacity: z.number(),
|
||||
})
|
||||
),
|
||||
lighting: z.string(),
|
||||
sortOrder: z.number().optional(),
|
||||
}),
|
||||
id: z.string(),
|
||||
type: z.string(),
|
||||
})
|
||||
),
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ import { unstable_cache } from "next/cache"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
|
||||
import { metrics } from "./metrics"
|
||||
import {
|
||||
citiesByCountrySchema,
|
||||
citiesSchema,
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
locationsSchema,
|
||||
} from "./output"
|
||||
|
||||
import type { Country } from "@/types/enums/country"
|
||||
import { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest"
|
||||
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
||||
import type {
|
||||
@@ -20,8 +22,6 @@ import type {
|
||||
} from "@/types/trpc/routers/hotel/locations"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { Endpoint } from "@/lib/api/endpoints"
|
||||
import { Country } from "@/types/enums/country"
|
||||
import { metrics } from "./metrics"
|
||||
|
||||
export function getPoiGroupByCategoryName(category: string | undefined) {
|
||||
if (!category) return PointOfInterestGroupEnum.LOCATION
|
||||
|
||||
Reference in New Issue
Block a user