fix(SW-978): Small fixes
This commit is contained in:
@@ -14,7 +14,7 @@ import { setLang } from "@/i18n/serverContext"
|
|||||||
|
|
||||||
import { fetchAvailableHotels, getFiltersFromHotels } from "../../utils"
|
import { fetchAvailableHotels, getFiltersFromHotels } from "../../utils"
|
||||||
|
|
||||||
import { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
import type { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
||||||
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
|
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
|
||||||
import type { LangParams, PageArgs } from "@/types/params"
|
import type { LangParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import { setLang } from "@/i18n/serverContext"
|
|||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
|
|
||||||
import { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
import type { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
||||||
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
|
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
|
||||||
import { AlertTypeEnum } from "@/types/enums/alert"
|
import { AlertTypeEnum } from "@/types/enums/alert"
|
||||||
import { LangParams, PageArgs } from "@/types/params"
|
import { LangParams, PageArgs } from "@/types/params"
|
||||||
@@ -112,6 +112,8 @@ export default async function SelectHotelPage({
|
|||||||
|
|
||||||
const isAllUnavailable = hotels.every((hotel) => hotel.price === undefined)
|
const isAllUnavailable = hotels.every((hotel) => hotel.price === undefined)
|
||||||
|
|
||||||
|
console.log("searchParams.city", searchParams.city)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { getHotelData } from "@/lib/trpc/memoizedRequests"
|
import { getHotelData } from "@/lib/trpc/memoizedRequests"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
import { badRequestError } from "@/server/errors/trpc"
|
|
||||||
|
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export default function HotelCardDialogListing({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.hotelCardDialogListing} ref={dialogRef}>
|
<div className={styles.hotelCardDialogListing} ref={dialogRef}>
|
||||||
{hotelsPinData?.length &&
|
{!!hotelsPinData?.length &&
|
||||||
hotelsPinData.map((data) => {
|
hotelsPinData.map((data) => {
|
||||||
const isActive = data.name === activeCard
|
const isActive = data.name === activeCard
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -5,6 +5,25 @@ import { getUrlWithSignature } from "@/utils/map"
|
|||||||
|
|
||||||
import { StaticMapProps } from "@/types/components/maps/staticMap"
|
import { StaticMapProps } from "@/types/components/maps/staticMap"
|
||||||
|
|
||||||
|
function getCenter({
|
||||||
|
coordinates,
|
||||||
|
city,
|
||||||
|
country,
|
||||||
|
}: {
|
||||||
|
coordinates?: { lat: number; lng: number }
|
||||||
|
city?: string
|
||||||
|
country?: string
|
||||||
|
}): string | undefined {
|
||||||
|
switch (true) {
|
||||||
|
case !!coordinates:
|
||||||
|
return `${coordinates.lat},${coordinates.lng}`
|
||||||
|
case !!country:
|
||||||
|
return `${city}, ${country}`
|
||||||
|
default:
|
||||||
|
return city
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function StaticMap({
|
export default function StaticMap({
|
||||||
city,
|
city,
|
||||||
country,
|
country,
|
||||||
@@ -19,9 +38,7 @@ export default function StaticMap({
|
|||||||
const key = env.GOOGLE_STATIC_MAP_KEY
|
const key = env.GOOGLE_STATIC_MAP_KEY
|
||||||
const secret = env.GOOGLE_STATIC_MAP_SIGNATURE_SECRET
|
const secret = env.GOOGLE_STATIC_MAP_SIGNATURE_SECRET
|
||||||
const baseUrl = "https://maps.googleapis.com/maps/api/staticmap"
|
const baseUrl = "https://maps.googleapis.com/maps/api/staticmap"
|
||||||
const center = coordinates
|
const center = getCenter({ coordinates, city, country })
|
||||||
? `${coordinates.lat},${coordinates.lng}`
|
|
||||||
: `${city}, ${country}`
|
|
||||||
|
|
||||||
if (!center) {
|
if (!center) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user