feat(SW-2863): Move contentstack router to trpc package * Add exports to packages and lint rule to prevent relative imports * Add env to trpc package * Add eslint to trpc package * Apply lint rules * Use direct imports from trpc package * Add lint-staged config to trpc * Move lang enum to common * Restructure trpc package folder structure * WIP first step * update internal imports in trpc * Fix most errors in scandic-web Just 100 left... * Move Props type out of trpc * Fix CategorizedFilters types * Move more schemas in hotel router * Fix deps * fix getNonContentstackUrls * Fix import error * Fix entry error handling * Fix generateMetadata metrics * Fix alertType enum * Fix duplicated types * lint:fix * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package * Fix broken imports * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package Approved-by: Linus Flood
123 lines
3.6 KiB
TypeScript
123 lines
3.6 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import { Toast } from "@/components/TempDesignSystem/Toasts"
|
|
import { trackMyStayPageLink } from "@/utils/tracking"
|
|
|
|
import SummaryCard from "./SummaryCard"
|
|
|
|
import styles from "./bookingSummary.module.css"
|
|
|
|
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
|
|
|
|
interface BookingSummaryProps {
|
|
hotel: Hotel
|
|
}
|
|
|
|
export default function BookingSummary({ hotel }: BookingSummaryProps) {
|
|
const intl = useIntl()
|
|
|
|
const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${hotel.location.latitude},${hotel.location.longitude}`
|
|
|
|
return (
|
|
<div className={styles.bookingSummary}>
|
|
<Typography variant="Title/sm">
|
|
<h2 className={styles.title}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Practical information",
|
|
})}
|
|
</h2>
|
|
</Typography>
|
|
<div className={styles.bookingSummaryContent}>
|
|
<SummaryCard
|
|
title={
|
|
<Typography variant="Body/Paragraph/mdBold">
|
|
<p>{hotel.name}</p>
|
|
</Typography>
|
|
}
|
|
image={{
|
|
src: "/_static/img/scandic-service.svg",
|
|
alt: "Scandic service",
|
|
}}
|
|
texts={[
|
|
hotel.address.streetAddress,
|
|
`${hotel.address.zipCode} ${hotel.address.city}`,
|
|
]}
|
|
supportingText={intl.formatMessage(
|
|
{
|
|
defaultMessage: "Long {long} ∙ Lat {lat}",
|
|
},
|
|
{
|
|
lat: hotel.location.latitude,
|
|
long: hotel.location.longitude,
|
|
}
|
|
)}
|
|
links={[
|
|
{
|
|
href: directionsUrl,
|
|
text: intl.formatMessage({
|
|
defaultMessage: "Directions",
|
|
}),
|
|
icon: (
|
|
<MaterialIcon
|
|
icon="directions"
|
|
size={20}
|
|
color="Icon/Interactive/Default"
|
|
/>
|
|
),
|
|
onClick: () => trackMyStayPageLink("see on map"),
|
|
},
|
|
{
|
|
href: `mailto:${hotel.contactInformation.email}`,
|
|
text: intl.formatMessage({
|
|
defaultMessage: "Email",
|
|
}),
|
|
icon: (
|
|
<MaterialIcon
|
|
icon="mail"
|
|
size={20}
|
|
color="Icon/Interactive/Default"
|
|
/>
|
|
),
|
|
onClick: () => trackMyStayPageLink("email us"),
|
|
},
|
|
{
|
|
href: hotel.contactInformation.websiteUrl,
|
|
text: intl.formatMessage({
|
|
defaultMessage: "Homepage",
|
|
}),
|
|
icon: (
|
|
<MaterialIcon
|
|
icon="link"
|
|
size={20}
|
|
color="Icon/Interactive/Default"
|
|
/>
|
|
),
|
|
onClick: () => trackMyStayPageLink("hotel homepage"),
|
|
},
|
|
]}
|
|
/>
|
|
</div>
|
|
{hotel.specialAlerts.length > 0 && (
|
|
<div className={styles.toast}>
|
|
<Toast variant="info">
|
|
<ul>
|
|
{hotel.specialAlerts.map((alert) => (
|
|
<li key={alert.id}>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<span>{alert.text}</span>
|
|
</Typography>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</Toast>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|