fix(SW-769): removed categoryname enum from pointOfInterestSchema and use z.string() instead
This commit is contained in:
@@ -1,22 +1,15 @@
|
|||||||
import { IconName } from "@/types/components/icon"
|
import { IconName } from "@/types/components/icon"
|
||||||
import {
|
import { PointOfInterestGroupEnum } from "@/types/hotel"
|
||||||
PointOfInterestCategoryNameEnum,
|
|
||||||
PointOfInterestGroupEnum,
|
|
||||||
} from "@/types/hotel"
|
|
||||||
|
|
||||||
export function getIconByPoiGroupAndCategory(
|
export function getIconByPoiGroupAndCategory(
|
||||||
group: PointOfInterestGroupEnum,
|
group: PointOfInterestGroupEnum,
|
||||||
category?: PointOfInterestCategoryNameEnum
|
category?: string
|
||||||
) {
|
) {
|
||||||
switch (group) {
|
switch (group) {
|
||||||
case PointOfInterestGroupEnum.PUBLIC_TRANSPORT:
|
case PointOfInterestGroupEnum.PUBLIC_TRANSPORT:
|
||||||
return category === PointOfInterestCategoryNameEnum.AIRPORT
|
return category === "Airport" ? IconName.Airplane : IconName.Train
|
||||||
? IconName.Airplane
|
|
||||||
: IconName.Train
|
|
||||||
case PointOfInterestGroupEnum.ATTRACTIONS:
|
case PointOfInterestGroupEnum.ATTRACTIONS:
|
||||||
return category === PointOfInterestCategoryNameEnum.MUSEUM
|
return category === "Museum" ? IconName.Museum : IconName.Camera
|
||||||
? IconName.Museum
|
|
||||||
: IconName.Camera
|
|
||||||
case PointOfInterestGroupEnum.BUSINESS:
|
case PointOfInterestGroupEnum.BUSINESS:
|
||||||
return IconName.Business
|
return IconName.Business
|
||||||
case PointOfInterestGroupEnum.PARKING:
|
case PointOfInterestGroupEnum.PARKING:
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { AlertTypeEnum } from "@/types/enums/alert"
|
|||||||
import { CurrencyEnum } from "@/types/enums/currency"
|
import { CurrencyEnum } from "@/types/enums/currency"
|
||||||
import { FacilityEnum } from "@/types/enums/facilities"
|
import { FacilityEnum } from "@/types/enums/facilities"
|
||||||
import { PackageTypeEnum } from "@/types/enums/packages"
|
import { PackageTypeEnum } from "@/types/enums/packages"
|
||||||
import { PointOfInterestCategoryNameEnum } from "@/types/hotel"
|
|
||||||
|
|
||||||
const ratingsSchema = z
|
const ratingsSchema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -199,14 +198,12 @@ const rewardNightSchema = z.object({
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
const poiCategoryNames = z.nativeEnum(PointOfInterestCategoryNameEnum)
|
|
||||||
|
|
||||||
export const pointOfInterestSchema = z
|
export const pointOfInterestSchema = z
|
||||||
.object({
|
.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
distance: z.number(),
|
distance: z.number(),
|
||||||
category: z.object({
|
category: z.object({
|
||||||
name: poiCategoryNames,
|
name: z.string(),
|
||||||
group: z.string(),
|
group: z.string(),
|
||||||
}),
|
}),
|
||||||
location: locationSchema,
|
location: locationSchema,
|
||||||
|
|||||||
@@ -12,39 +12,34 @@ import {
|
|||||||
type Countries,
|
type Countries,
|
||||||
} from "./output"
|
} from "./output"
|
||||||
|
|
||||||
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
|
||||||
import {
|
|
||||||
PointOfInterestCategoryNameEnum,
|
|
||||||
PointOfInterestGroupEnum,
|
|
||||||
} from "@/types/hotel"
|
|
||||||
import { HotelLocation } from "@/types/trpc/routers/hotel/locations"
|
|
||||||
import type { Lang } from "@/constants/languages"
|
import type { Lang } from "@/constants/languages"
|
||||||
import type { Endpoint } from "@/lib/api/endpoints"
|
import type { Endpoint } from "@/lib/api/endpoints"
|
||||||
|
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
||||||
|
import { PointOfInterestGroupEnum } from "@/types/hotel"
|
||||||
|
import { HotelLocation } from "@/types/trpc/routers/hotel/locations"
|
||||||
|
|
||||||
export function getPoiGroupByCategoryName(
|
export function getPoiGroupByCategoryName(category: string) {
|
||||||
category: PointOfInterestCategoryNameEnum
|
|
||||||
) {
|
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case PointOfInterestCategoryNameEnum.AIRPORT:
|
case "Airport":
|
||||||
case PointOfInterestCategoryNameEnum.BUS_TERMINAL:
|
case "Bus terminal":
|
||||||
case PointOfInterestCategoryNameEnum.TRANSPORTATIONS:
|
case "Transportations":
|
||||||
return PointOfInterestGroupEnum.PUBLIC_TRANSPORT
|
return PointOfInterestGroupEnum.PUBLIC_TRANSPORT
|
||||||
case PointOfInterestCategoryNameEnum.AMUSEMENT_PARK:
|
case "Amusement park":
|
||||||
case PointOfInterestCategoryNameEnum.MUSEUM:
|
case "Museum":
|
||||||
case PointOfInterestCategoryNameEnum.SPORTS:
|
case "Sports":
|
||||||
case PointOfInterestCategoryNameEnum.THEATRE:
|
case "Theatre":
|
||||||
case PointOfInterestCategoryNameEnum.TOURIST:
|
case "Tourist":
|
||||||
case PointOfInterestCategoryNameEnum.ZOO:
|
case "Zoo":
|
||||||
return PointOfInterestGroupEnum.ATTRACTIONS
|
return PointOfInterestGroupEnum.ATTRACTIONS
|
||||||
case PointOfInterestCategoryNameEnum.NEARBY_COMPANIES:
|
case "Nearby companies":
|
||||||
case PointOfInterestCategoryNameEnum.FAIR:
|
case "Fair":
|
||||||
return PointOfInterestGroupEnum.BUSINESS
|
return PointOfInterestGroupEnum.BUSINESS
|
||||||
case PointOfInterestCategoryNameEnum.PARKING_GARAGE:
|
case "Parking / Garage":
|
||||||
return PointOfInterestGroupEnum.PARKING
|
return PointOfInterestGroupEnum.PARKING
|
||||||
case PointOfInterestCategoryNameEnum.SHOPPING:
|
case "Shopping":
|
||||||
case PointOfInterestCategoryNameEnum.RESTAURANT:
|
case "Restaurant":
|
||||||
return PointOfInterestGroupEnum.SHOPPING_DINING
|
return PointOfInterestGroupEnum.SHOPPING_DINING
|
||||||
case PointOfInterestCategoryNameEnum.HOSPITAL:
|
case "Hospital":
|
||||||
default:
|
default:
|
||||||
return PointOfInterestGroupEnum.LOCATION
|
return PointOfInterestGroupEnum.LOCATION
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,11 @@ import { poiVariants } from "@/components/Maps/Markers/Poi/variants"
|
|||||||
|
|
||||||
import type { VariantProps } from "class-variance-authority"
|
import type { VariantProps } from "class-variance-authority"
|
||||||
|
|
||||||
import {
|
import type { PointOfInterestGroupEnum } from "@/types/hotel"
|
||||||
PointOfInterestCategoryNameEnum,
|
|
||||||
PointOfInterestGroupEnum,
|
|
||||||
} from "@/types/hotel"
|
|
||||||
|
|
||||||
export interface PoiMarkerProps extends VariantProps<typeof poiVariants> {
|
export interface PoiMarkerProps extends VariantProps<typeof poiVariants> {
|
||||||
group: PointOfInterestGroupEnum
|
group: PointOfInterestGroupEnum
|
||||||
categoryName?: PointOfInterestCategoryNameEnum
|
categoryName?: string
|
||||||
size?: number
|
size?: number
|
||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,26 +26,6 @@ export type GalleryImage = z.infer<typeof imageSchema>
|
|||||||
|
|
||||||
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
|
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
|
||||||
|
|
||||||
export enum PointOfInterestCategoryNameEnum {
|
|
||||||
AIRPORT = "Airport",
|
|
||||||
AMUSEMENT_PARK = "Amusement park",
|
|
||||||
BUS_TERMINAL = "Bus terminal",
|
|
||||||
FAIR = "Fair",
|
|
||||||
HOSPITAL = "Hospital",
|
|
||||||
HOTEL = "Hotel",
|
|
||||||
MARKETING_CITY = "Marketing city",
|
|
||||||
MUSEUM = "Museum",
|
|
||||||
NEARBY_COMPANIES = "Nearby companies",
|
|
||||||
PARKING_GARAGE = "Parking / Garage",
|
|
||||||
RESTAURANT = "Restaurant",
|
|
||||||
SHOPPING = "Shopping",
|
|
||||||
SPORTS = "Sports",
|
|
||||||
THEATRE = "Theatre",
|
|
||||||
TOURIST = "Tourist",
|
|
||||||
TRANSPORTATIONS = "Transportations",
|
|
||||||
ZOO = "Zoo",
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum PointOfInterestGroupEnum {
|
export enum PointOfInterestGroupEnum {
|
||||||
PUBLIC_TRANSPORT = "Public transport",
|
PUBLIC_TRANSPORT = "Public transport",
|
||||||
ATTRACTIONS = "Attractions",
|
ATTRACTIONS = "Attractions",
|
||||||
|
|||||||
Reference in New Issue
Block a user