refactor(SW-303): refactoring
This commit is contained in:
@@ -26,22 +26,23 @@ export const activityCardSchema = z.object({
|
||||
}),
|
||||
})
|
||||
|
||||
const contentBlockActivity = z.object({
|
||||
__typename: z.literal(
|
||||
HotelBlocksTypenameEnum.HotelPageContentUpcomingActivitiesCard
|
||||
),
|
||||
upcoming_activities_card: activityCardSchema.optional(),
|
||||
})
|
||||
|
||||
const contentBlockItem = z.discriminatedUnion("__typename", [
|
||||
contentBlockActivity,
|
||||
])
|
||||
|
||||
export const validateHotelPageSchema = z.object({
|
||||
hotel_page: z.object({
|
||||
hotel_page_id: z.string(),
|
||||
title: z.string(),
|
||||
url: z.string(),
|
||||
content: z
|
||||
.array(
|
||||
z.object({
|
||||
__typename: z.literal(
|
||||
HotelBlocksTypenameEnum.HotelPageContentUpcomingActivitiesCard
|
||||
),
|
||||
upcoming_activities_card: activityCardSchema.optional(),
|
||||
})
|
||||
)
|
||||
.nullable()
|
||||
.optional(),
|
||||
content: z.array(contentBlockItem).nullable(),
|
||||
}),
|
||||
})
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ const availabilityFailCounter = meter.createCounter(
|
||||
"trpc.hotel.availability-fail"
|
||||
)
|
||||
|
||||
async function getContenstackData(
|
||||
async function getContentstackData(
|
||||
locale: string,
|
||||
uid: string | null | undefined
|
||||
) {
|
||||
@@ -90,7 +90,7 @@ export const hotelQueryRouter = router({
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { lang, uid } = ctx
|
||||
const { include } = input
|
||||
const contentstackData = await getContenstackData(lang, uid)
|
||||
const contentstackData = await getContentstackData(lang, uid)
|
||||
const hotelId = contentstackData?.hotel_page_id
|
||||
|
||||
if (!hotelId) {
|
||||
|
||||
@@ -39,9 +39,6 @@ export function getTheme(theme: CardProps["theme"]) {
|
||||
secondaryLinkColor = "burgundy"
|
||||
break
|
||||
case "primaryStrong":
|
||||
buttonTheme = "primaryStrong"
|
||||
primaryLinkColor = "red"
|
||||
secondaryLinkColor = "white"
|
||||
case "image":
|
||||
buttonTheme = "primaryStrong"
|
||||
primaryLinkColor = "red"
|
||||
|
||||
Reference in New Issue
Block a user