Merged in fix/SW-2485-hotel-directions-name (pull request #2641)

fix(SW-2485): add name and address to hotel directions

* fix(SW-2485): add name and address to hotel directions

* fix(SW-2485): use name and address instead of coordinates


Approved-by: Matilda Landström
This commit is contained in:
Bianca Widstam
2025-08-14 07:24:37 +00:00
parent a362d236fb
commit 3fb0219b3e
7 changed files with 19 additions and 18 deletions

View File

@@ -14,16 +14,16 @@ import type { ContactInformationProps } from "@/types/components/hotelPage/sidep
export default async function ContactInformation({ export default async function ContactInformation({
hotelAddress, hotelAddress,
coordinates,
contact, contact,
socials, socials,
ecoLabels, ecoLabels,
hotelName,
}: ContactInformationProps) { }: ContactInformationProps) {
const intl = await getIntl() const intl = await getIntl()
const lang = await getLang() const lang = await getLang()
const { latitude, longitude } = coordinates const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(
const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}` `${hotelName}, ${hotelAddress.streetAddress}, ${hotelAddress.zipCode} ${hotelAddress.city}`
)}`
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<Typography variant="Title/Subtitle/lg"> <Typography variant="Title/Subtitle/lg">

View File

@@ -13,11 +13,11 @@ import type { AboutTheHotelSidePeekProps } from "@/types/components/hotelPage/si
export default async function AboutTheHotelSidePeek({ export default async function AboutTheHotelSidePeek({
hotelAddress, hotelAddress,
coordinates,
contact, contact,
socials, socials,
ecoLabels, ecoLabels,
descriptions, descriptions,
hotelName,
}: AboutTheHotelSidePeekProps) { }: AboutTheHotelSidePeekProps) {
const intl = await getIntl() const intl = await getIntl()
@@ -34,10 +34,10 @@ export default async function AboutTheHotelSidePeek({
<section className={styles.wrapper}> <section className={styles.wrapper}>
<ContactInformation <ContactInformation
hotelAddress={hotelAddress} hotelAddress={hotelAddress}
coordinates={coordinates}
contact={contact} contact={contact}
socials={socials} socials={socials}
ecoLabels={ecoLabels} ecoLabels={ecoLabels}
hotelName={hotelName}
/> />
<Divider /> <Divider />

View File

@@ -261,11 +261,11 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
/> />
<AboutTheHotelSidePeek <AboutTheHotelSidePeek
hotelAddress={address} hotelAddress={address}
coordinates={location}
contact={contactInformation} contact={contactInformation}
socials={socialMedia} socials={socialMedia}
ecoLabels={hotelFacts.ecoLabels} ecoLabels={hotelFacts.ecoLabels}
descriptions={hotelContent.texts} descriptions={hotelContent.texts}
hotelName={name}
/> />
{pageSections.wellness ? ( {pageSections.wellness ? (
<WellnessAndExerciseSidePeek <WellnessAndExerciseSidePeek

View File

@@ -44,7 +44,9 @@ export default function Contact({ hotel }: ContactProps) {
})} })}
</Body> </Body>
<Link <Link
href={`https://www.google.com/maps/dir/?api=1&destination=${hotel.location.latitude},${hotel.location.longitude}`} href={`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(
`${hotel.name}, ${hotel.address.streetAddress}, ${hotel.address.zipCode} ${hotel.address.city}`
)}`}
> >
<span className={styles.link}> <span className={styles.link}>
{intl.formatMessage({ {intl.formatMessage({

View File

@@ -21,8 +21,9 @@ interface BookingSummaryProps {
export default function BookingSummary({ hotel }: BookingSummaryProps) { export default function BookingSummary({ hotel }: BookingSummaryProps) {
const intl = useIntl() const intl = useIntl()
const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${hotel.location.latitude},${hotel.location.longitude}` const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(
`${hotel.name}, ${hotel.address.streetAddress}, ${hotel.address.zipCode} ${hotel.address.city}`
)}`
return ( return (
<div className={styles.bookingSummary}> <div className={styles.bookingSummary}>
<Typography variant="Title/sm"> <Typography variant="Title/sm">

View File

@@ -13,9 +13,11 @@ import styles from "./notCancelled.module.css"
export default function NotCancelled() { export default function NotCancelled() {
const intl = useIntl() const intl = useIntl()
const location = useMyStayStore((state) => state.hotel.location) const { hotel } = useMyStayStore((state) => state)
const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${location.latitude},${location.longitude}` const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(
`${hotel.name}, ${hotel.address.streetAddress}, ${hotel.address.zipCode} ${hotel.address.city}`
)}`
return ( return (
<> <>
<ManageStay /> <ManageStay />

View File

@@ -1,16 +1,12 @@
import type { import type { Hotel, HotelAddress } from "@scandic-hotels/trpc/types/hotel"
Hotel,
HotelAddress,
HotelLocation,
} from "@scandic-hotels/trpc/types/hotel"
export type AboutTheHotelSidePeekProps = { export type AboutTheHotelSidePeekProps = {
hotelAddress: HotelAddress hotelAddress: HotelAddress
coordinates: HotelLocation
contact: Hotel["contactInformation"] contact: Hotel["contactInformation"]
socials: Hotel["socialMedia"] socials: Hotel["socialMedia"]
ecoLabels: Hotel["hotelFacts"]["ecoLabels"] ecoLabels: Hotel["hotelFacts"]["ecoLabels"]
descriptions: Hotel["hotelContent"]["texts"] descriptions: Hotel["hotelContent"]["texts"]
hotelName: Hotel["name"]
} }
export type ContactInformationProps = Omit< export type ContactInformationProps = Omit<