feat: filter route changes
This commit is contained in:
@@ -22,7 +22,7 @@ export default async function SelectHotelPage({
|
||||
|
||||
return (
|
||||
<main className={styles.main}>
|
||||
<HotelFilter filter={hotelFilters} />
|
||||
<HotelFilter filters={hotelFilters} />
|
||||
<section className={styles.section}>
|
||||
{hotels.map((hotel) => (
|
||||
<HotelCard key={hotel.name} hotel={hotel} />
|
||||
|
||||
@@ -4,35 +4,35 @@ import styles from "./hotelFilter.module.css"
|
||||
|
||||
import { HotelFilterProps } from "@/types/components/hotelReservation/selectHotel/hotelFilterProps"
|
||||
|
||||
export default async function HotelFilter({ filter }: HotelFilterProps) {
|
||||
export default async function HotelFilter({ filters }: HotelFilterProps) {
|
||||
const { formatMessage } = await getIntl()
|
||||
|
||||
return (
|
||||
<aside className={styles.container}>
|
||||
<div className={styles.facilities}>
|
||||
{formatMessage({ id: "Room facilities" })}
|
||||
{filter[0].filter.roomFacilities.map((filter, index) => (
|
||||
{filters.filterType.roomFacilities.map((roomFilter, index) => (
|
||||
<div key={index} className={styles.filter}>
|
||||
<input id={filter} name={filter} type="checkbox" />
|
||||
<label htmlFor={filter}>{filter}</label>
|
||||
<input id={roomFilter} name={roomFilter} type="checkbox" />
|
||||
<label htmlFor={roomFilter}>{roomFilter}</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className={styles.facilities}>
|
||||
{formatMessage({ id: "Hotel facilities" })}
|
||||
{filter[0].filter.hotelFacilities.map((filter, index) => (
|
||||
{filters.filterType.hotelFacilities.map((hotelFilter, index) => (
|
||||
<div key={index} className={styles.filter}>
|
||||
<input id={filter} name={filter} type="checkbox" />
|
||||
<label htmlFor={filter}>{filter}</label>
|
||||
<input id={hotelFilter} name={hotelFilter} type="checkbox" />
|
||||
<label htmlFor={hotelFilter}>{hotelFilter}</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className={styles.facilities}>
|
||||
{formatMessage({ id: "Hotel surroundings" })}
|
||||
{filter[0].filter.hotelSurroundings.map((filter, index) => (
|
||||
{filters.filterType.hotelSurroundings.map((sorroundings, index) => (
|
||||
<div key={index} className={styles.filter}>
|
||||
<input id={filter} name={filter} type="checkbox" />
|
||||
<label htmlFor={filter}>{filter}</label>
|
||||
<input id={sorroundings} name={sorroundings} type="checkbox" />
|
||||
<label htmlFor={sorroundings}>{sorroundings}</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -483,12 +483,12 @@ export const getRatesSchema = z.array(rate)
|
||||
export type Rate = z.infer<typeof rate>
|
||||
|
||||
const hotelFilter = z.object({
|
||||
filter: z.object({
|
||||
filterType: z.object({
|
||||
roomFacilities: z.array(z.string()),
|
||||
hotelFacilities: z.array(z.string()),
|
||||
hotelSurroundings: z.array(z.string()),
|
||||
}),
|
||||
})
|
||||
|
||||
export const getFiltersSchema = z.array(hotelFilter)
|
||||
export const getFiltersSchema = hotelFilter
|
||||
export type HotelFilter = z.infer<typeof hotelFilter>
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
[
|
||||
{
|
||||
"filter": {
|
||||
"roomFacilities": ["Balcony", "Bathub", "View", "Conntecting doors"],
|
||||
"hotelFacilities": [
|
||||
"Parking inside",
|
||||
"Parking outside",
|
||||
"Parking electric",
|
||||
"Sauna",
|
||||
"Pool",
|
||||
"Restaurant",
|
||||
"Bar",
|
||||
"Sky/rooftop bar",
|
||||
"Gym",
|
||||
"Coworking"
|
||||
],
|
||||
"hotelSurroundings": [
|
||||
"Beach",
|
||||
"Lake or sea",
|
||||
"Hiking",
|
||||
"Mountains",
|
||||
"Golf course"
|
||||
]
|
||||
}
|
||||
{
|
||||
"filterType": {
|
||||
"roomFacilities": ["Balcony", "Bathub", "View", "Conntecting doors"],
|
||||
"hotelFacilities": [
|
||||
"Parking inside",
|
||||
"Parking outside",
|
||||
"Parking electric",
|
||||
"Sauna",
|
||||
"Pool",
|
||||
"Restaurant",
|
||||
"Bar",
|
||||
"Sky/rooftop bar",
|
||||
"Gym",
|
||||
"Coworking"
|
||||
],
|
||||
"hotelSurroundings": [
|
||||
"Beach",
|
||||
"Lake or sea",
|
||||
"Hiking",
|
||||
"Mountains",
|
||||
"Golf course"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { HotelFilter } from "@/server/routers/hotels/output"
|
||||
|
||||
export type HotelFilterProps = { filter: HotelFilter[] }
|
||||
export type HotelFilterProps = { filters: HotelFilter }
|
||||
|
||||
Reference in New Issue
Block a user