feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions

View File

@@ -1,15 +1,29 @@
import { z } from "zod"
import type { Location } from "@/types/trpc/routers/hotel/locations"
export const bookingWidgetSchema = z.object({
search: z.object({
stayType: z.string(),
stayValue: z.string(),
}),
search: z.string({ coerce: true }).min(1, "Required"),
nights: z.object({
// Update this as required once started working with Date picker in Nights component
fromDate: z.string(),
toDate: z.string(),
}),
location: z.string().refine(
(value) => {
if (value) {
const parsedValue: Location = JSON.parse(decodeURIComponent(value))
switch (parsedValue?.type) {
case "cities":
case "hotels":
return true
default:
return false
}
}
},
{ message: "Required" }
),
bookingCode: z.string(), // Update this as required when working with booking codes component
redemption: z.boolean().default(false),
voucher: z.boolean().default(false),