Merged in fix/remove-translated-slugs (pull request #1390)

Fix(SW-1467): Remove translation of hotel page sidepeek slugs

* fix(SW-1467): remove translation of sidepeek slugs

* fix: update enums


Approved-by: Erik Tiekstra
Approved-by: Fredrik Thorsson
This commit is contained in:
Matilda Landström
2025-02-24 09:09:07 +00:00
parent dda236aa82
commit 49aaca9d28
13 changed files with 45 additions and 150 deletions

View File

@@ -1,23 +1,21 @@
import { amenities } from "@/constants/routes/hotelPageParams"
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
import { ChevronRightSmallIcon } from "@/components/Icons" import { ChevronRightSmallIcon } from "@/components/Icons"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"
import Body from "@/components/TempDesignSystem/Text/Body" import Body from "@/components/TempDesignSystem/Text/Body"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import styles from "./amenitiesList.module.css" import styles from "./amenitiesList.module.css"
import type { AmenitiesListProps } from "@/types/components/hotelPage/amenities" import type { AmenitiesListProps } from "@/types/components/hotelPage/amenities"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
export default async function AmenitiesList({ export default async function AmenitiesList({
detailedFacilities, detailedFacilities,
}: AmenitiesListProps) { }: AmenitiesListProps) {
const intl = await getIntl() const intl = await getIntl()
const facilities = detailedFacilities.slice(0, 5) const facilities = detailedFacilities.slice(0, 5)
const lang = getLang()
return ( return (
<section className={styles.amenitiesContainer}> <section className={styles.amenitiesContainer}>
<Subtitle type="two" color="black"> <Subtitle type="two" color="black">
@@ -43,7 +41,7 @@ export default async function AmenitiesList({
</div> </div>
<Link <Link
scroll={false} scroll={false}
href={`#s-${amenities[lang]}`} href={`#s-${SidepeekSlugs.amenities}`}
color="burgundy" color="burgundy"
variant="icon" variant="icon"
className={styles.showAllAmenities} className={styles.showAllAmenities}

View File

@@ -1,22 +1,19 @@
import { activities } from "@/constants/routes/hotelPageParams"
import Card from "@/components/TempDesignSystem/Card" import Card from "@/components/TempDesignSystem/Card"
import CardImage from "@/components/TempDesignSystem/Card/CardImage" import CardImage from "@/components/TempDesignSystem/Card/CardImage"
import Grids from "@/components/TempDesignSystem/Grids" import Grids from "@/components/TempDesignSystem/Grids"
import { getLang } from "@/i18n/serverContext"
import styles from "./cardGrid.module.css" import styles from "./cardGrid.module.css"
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
import type { ActivityCard } from "@/types/trpc/routers/contentstack/hotelPage" import type { ActivityCard } from "@/types/trpc/routers/contentstack/hotelPage"
import type { CardProps } from "@/components/TempDesignSystem/Card/card" import type { CardProps } from "@/components/TempDesignSystem/Card/card"
export default function ActivitiesCardGrid(activitiesCard: ActivityCard) { export default function ActivitiesCardGrid(activitiesCard: ActivityCard) {
const lang = getLang()
const hasImage = activitiesCard.backgroundImage const hasImage = activitiesCard.backgroundImage
const updatedCard: CardProps = { const updatedCard: CardProps = {
...activitiesCard, ...activitiesCard,
id: activities[lang], id: HotelHashValues.activities,
theme: hasImage ? "image" : "primaryDark", theme: hasImage ? "image" : "primaryDark",
primaryButton: hasImage primaryButton: hasImage
? { ? {

View File

@@ -1,5 +1,3 @@
import { about } from "@/constants/routes/hotelPageParams"
import { ChevronRightSmallIcon, TripAdvisorIcon } from "@/components/Icons" import { ChevronRightSmallIcon, TripAdvisorIcon } from "@/components/Icons"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript" import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
@@ -7,11 +5,11 @@ import Body from "@/components/TempDesignSystem/Text/Body"
import Preamble from "@/components/TempDesignSystem/Text/Preamble" import Preamble from "@/components/TempDesignSystem/Text/Preamble"
import Title from "@/components/TempDesignSystem/Text/Title" import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { getSingleDecimal } from "@/utils/numberFormatting" import { getSingleDecimal } from "@/utils/numberFormatting"
import styles from "./introSection.module.css" import styles from "./introSection.module.css"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { IntroSectionProps } from "./types" import type { IntroSectionProps } from "./types"
export default async function IntroSection({ export default async function IntroSection({
@@ -28,7 +26,7 @@ export default async function IntroSection({
{ id: "{number} km to city center" }, { id: "{number} km to city center" },
{ number: getSingleDecimal(distanceToCentre / 1000) } { number: getSingleDecimal(distanceToCentre / 1000) }
) )
const lang = getLang()
const formattedLocationText = `${streetAddress}, ${city} (${formattedDistanceText})` const formattedLocationText = `${streetAddress}, ${city} (${formattedDistanceText})`
const hasTripAdvisorData = !!( const hasTripAdvisorData = !!(
tripAdvisor?.rating && tripAdvisor?.rating &&
@@ -72,7 +70,7 @@ export default async function IntroSection({
className={styles.introLink} className={styles.introLink}
color="burgundy" color="burgundy"
variant="icon" variant="icon"
href={`#s-${about[lang]}`} href={`#s-${SidepeekSlugs.about}`}
scroll={false} scroll={false}
> >
{intl.formatMessage({ id: "Read more about the hotel" })} {intl.formatMessage({ id: "Read more about the hotel" })}

View File

@@ -1,16 +1,14 @@
import { about } from "@/constants/routes/hotelPageParams"
import Divider from "@/components/TempDesignSystem/Divider" import Divider from "@/components/TempDesignSystem/Divider"
import SidePeek from "@/components/TempDesignSystem/SidePeek" import SidePeek from "@/components/TempDesignSystem/SidePeek"
import Body from "@/components/TempDesignSystem/Text/Body" import Body from "@/components/TempDesignSystem/Text/Body"
import Preamble from "@/components/TempDesignSystem/Text/Preamble" import Preamble from "@/components/TempDesignSystem/Text/Preamble"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import ContactInformation from "./ContactInformation" import ContactInformation from "./ContactInformation"
import styles from "./aboutTheHotel.module.css" import styles from "./aboutTheHotel.module.css"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { AboutTheHotelSidePeekProps } from "@/types/components/hotelPage/sidepeek/aboutTheHotel" import type { AboutTheHotelSidePeekProps } from "@/types/components/hotelPage/sidepeek/aboutTheHotel"
export default async function AboutTheHotelSidePeek({ export default async function AboutTheHotelSidePeek({
@@ -21,12 +19,11 @@ export default async function AboutTheHotelSidePeek({
ecoLabels, ecoLabels,
descriptions, descriptions,
}: AboutTheHotelSidePeekProps) { }: AboutTheHotelSidePeekProps) {
const lang = getLang()
const intl = await getIntl() const intl = await getIntl()
return ( return (
<SidePeek <SidePeek
contentKey={about[lang]} contentKey={SidepeekSlugs.about}
title={intl.formatMessage({ id: "About the hotel" })} title={intl.formatMessage({ id: "About the hotel" })}
> >
<section className={styles.wrapper}> <section className={styles.wrapper}>

View File

@@ -1,9 +1,6 @@
import { amenities } from "@/constants/routes/hotelPageParams"
import Accordion from "@/components/TempDesignSystem/Accordion" import Accordion from "@/components/TempDesignSystem/Accordion"
import SidePeek from "@/components/TempDesignSystem/SidePeek" import SidePeek from "@/components/TempDesignSystem/SidePeek"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { import {
AccessibilityAmenity, AccessibilityAmenity,
@@ -13,6 +10,7 @@ import {
} from "./AccordionAmenities" } from "./AccordionAmenities"
import FilteredAmenities from "./FilteredAmenities" import FilteredAmenities from "./FilteredAmenities"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { AmenitiesSidePeekProps } from "@/types/components/hotelPage/sidepeek/amenities" import type { AmenitiesSidePeekProps } from "@/types/components/hotelPage/sidepeek/amenities"
import { FacilityEnum } from "@/types/enums/facilities" import { FacilityEnum } from "@/types/enums/facilities"
@@ -23,7 +21,6 @@ export default async function AmenitiesSidePeek({
accessibility, accessibility,
restaurants, restaurants,
}: AmenitiesSidePeekProps) { }: AmenitiesSidePeekProps) {
const lang = getLang()
const intl = await getIntl() const intl = await getIntl()
const amenitiesToRemove = [ const amenitiesToRemove = [
@@ -54,7 +51,7 @@ export default async function AmenitiesSidePeek({
return ( return (
<SidePeek <SidePeek
contentKey={amenities[lang]} contentKey={SidepeekSlugs.amenities}
title={intl.formatMessage({ id: "Amenities" })} title={intl.formatMessage({ id: "Amenities" })}
> >
<Accordion> <Accordion>

View File

@@ -1,5 +1,3 @@
import { meetingsAndConferences } from "@/constants/routes/hotelPageParams"
import Image from "@/components/Image" import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"
@@ -8,12 +6,12 @@ import Body from "@/components/TempDesignSystem/Text/Body"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import Title from "@/components/TempDesignSystem/Text/Title" import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { getConferenceRoomTexts } from "./util" import { getConferenceRoomTexts } from "./util"
import styles from "./meetingsAndConferences.module.css" import styles from "./meetingsAndConferences.module.css"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { MeetingsAndConferencesSidePeekProps } from "@/types/components/hotelPage/sidepeek/meetingsAndConferences" import type { MeetingsAndConferencesSidePeekProps } from "@/types/components/hotelPage/sidepeek/meetingsAndConferences"
export default async function MeetingsAndConferencesSidePeek({ export default async function MeetingsAndConferencesSidePeek({
@@ -22,7 +20,6 @@ export default async function MeetingsAndConferencesSidePeek({
meetingRooms, meetingRooms,
meetingPageUrl, meetingPageUrl,
}: MeetingsAndConferencesSidePeekProps) { }: MeetingsAndConferencesSidePeekProps) {
const lang = getLang()
const intl = await getIntl() const intl = await getIntl()
const { seatingText, roomText } = await getConferenceRoomTexts(meetingRooms) const { seatingText, roomText } = await getConferenceRoomTexts(meetingRooms)
@@ -38,7 +35,7 @@ export default async function MeetingsAndConferencesSidePeek({
return ( return (
<SidePeek <SidePeek
contentKey={meetingsAndConferences[lang]} contentKey={SidepeekSlugs.meetings}
title={intl.formatMessage({ id: "Meetings & Conferences" })} title={intl.formatMessage({ id: "Meetings & Conferences" })}
> >
<div className={styles.wrapper}> <div className={styles.wrapper}>

View File

@@ -1,24 +1,21 @@
import { restaurantAndBar } from "@/constants/routes/hotelPageParams"
import SidePeek from "@/components/TempDesignSystem/SidePeek" import SidePeek from "@/components/TempDesignSystem/SidePeek"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import RestaurantBarItem from "./RestaurantBarItem" import RestaurantBarItem from "./RestaurantBarItem"
import styles from "./restaurantBar.module.css" import styles from "./restaurantBar.module.css"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { RestaurantBarSidePeekProps } from "@/types/components/hotelPage/sidepeek/restaurantBar" import type { RestaurantBarSidePeekProps } from "@/types/components/hotelPage/sidepeek/restaurantBar"
export default async function RestaurantBarSidePeek({ export default async function RestaurantBarSidePeek({
restaurants, restaurants,
}: RestaurantBarSidePeekProps) { }: RestaurantBarSidePeekProps) {
const intl = await getIntl() const intl = await getIntl()
const lang = getLang()
return ( return (
<SidePeek <SidePeek
contentKey={restaurantAndBar[lang]} contentKey={SidepeekSlugs.restaurant}
title={intl.formatMessage({ id: "Restaurant & Bar" })} title={intl.formatMessage({ id: "Restaurant & Bar" })}
> >
<div className={styles.content}> <div className={styles.content}>

View File

@@ -25,6 +25,7 @@ export default async function RoomSidePeek({ room }: RoomSidePeekProps) {
const ctaUrl = "" const ctaUrl = ""
const galleryImages = mapApiImagesToGalleryImages(images) const galleryImages = mapApiImagesToGalleryImages(images)
return ( return (
<SidePeek contentKey={getRoomNameAsParam(room.name)} title={room.name}> <SidePeek contentKey={getRoomNameAsParam(room.name)} title={room.name}>
<div className={styles.content}> <div className={styles.content}>

View File

@@ -1,15 +1,13 @@
import { wellnessAndExercise } from "@/constants/routes/hotelPageParams"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"
import SidePeek from "@/components/TempDesignSystem/SidePeek" import SidePeek from "@/components/TempDesignSystem/SidePeek"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import Facility from "./Facility" import Facility from "./Facility"
import styles from "./wellnessAndExercise.module.css" import styles from "./wellnessAndExercise.module.css"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { WellnessAndExerciseSidePeekProps } from "@/types/components/hotelPage/sidepeek/wellnessAndExercise" import type { WellnessAndExerciseSidePeekProps } from "@/types/components/hotelPage/sidepeek/wellnessAndExercise"
export default async function WellnessAndExerciseSidePeek({ export default async function WellnessAndExerciseSidePeek({
@@ -18,11 +16,10 @@ export default async function WellnessAndExerciseSidePeek({
spaPage, spaPage,
}: WellnessAndExerciseSidePeekProps) { }: WellnessAndExerciseSidePeekProps) {
const intl = await getIntl() const intl = await getIntl()
const lang = getLang()
return ( return (
<SidePeek <SidePeek
contentKey={wellnessAndExercise[lang]} contentKey={SidepeekSlugs.wellness}
title={intl.formatMessage({ id: "Wellness & Exercise" })} title={intl.formatMessage({ id: "Wellness & Exercise" })}
> >
<div className={styles.wrapper}> <div className={styles.wrapper}>

View File

@@ -11,7 +11,12 @@ import type { HotelPage } from "@/types/trpc/routers/contentstack/hotelPage"
import type { Lang } from "@/constants/languages" import type { Lang } from "@/constants/languages"
export function getRoomNameAsParam(roomName: string) { export function getRoomNameAsParam(roomName: string) {
return roomName.replace(/[()]/g, "").replaceAll(" ", "-").toLowerCase() return roomName
.replace(/\s?\(.*\)$/, "")
.trim()
.replace(/[()]/g, "")
.replaceAll(" ", "-")
.toLowerCase()
} }
export function getTrackingPageData( export function getTrackingPageData(

View File

@@ -1,94 +0,0 @@
export const about = {
en: "about",
sv: "om-hotellet",
no: "om-hotellet",
fi: "hotellista",
da: "om-hotellet",
de: "uber-das-hotel",
}
export const amenities = {
en: "amenities",
sv: "bekvamligheter",
no: "fasiliteter",
da: "faciliteter",
fi: "palvelut",
de: "annehmlichkeiten",
}
export const wellnessAndExercise = {
en: "wellness-and-exercise",
sv: "halsa-och-träning",
no: "velvære-og-trening",
da: "wellness-og-motion",
fi: "hyvinvointia-ja-liikuntaa",
de: "Wellness-und-Bewegung",
}
export const activities = {
en: "activities",
sv: "aktiviteter",
no: "aktiviteter",
da: "aktiviteter",
fi: "toimintaa",
de: "Aktivitäten",
}
export const meetingsAndConferences = {
en: "meetings-and-conferences",
sv: "moten-och-konferenser",
no: "møter-og-konferansers",
da: "møder-og-konferencer",
fi: "kokoukset-ja-konferenssit",
de: "Tagungen-und-Konferenzen",
}
export const restaurantAndBar = {
en: "restaurant-and-bar",
sv: "restaurang-och-bar",
no: "restaurant-og-bar",
da: "restaurant-og-bar",
fi: "ravintola-ja-baari",
de: "Restaurant-und-Bar",
}
/*export const restaurant = {
en: "restaurant",
sv: "restaurang",
no: "restaurant",
da: "restaurant",
fi: "ravintola",
de: "Restaurant",
}
export const bar = {
en: "bar",
sv: "bar",
no: "bar",
da: "bar",
fi: "baari",
de: "Bar",
}
export const breakfastRestaurant = {
en: "breakfast-restaurant",
sv: "frukostrestaurang",
no: "frokostrestaurant",
da: "morgenmadsrestaurant",
fi: "aamiaisravintola",
de: "Frühstücksrestaurant",
}
*/
const params = {
about,
amenities,
wellnessAndExercise,
activities,
meetingsAndConferences,
restaurantAndBar,
/*bar,
restaurant,
breakfastRestaurant,*/
}
export default params

View File

@@ -1,3 +1,12 @@
export interface HotelPageProps { export interface HotelPageProps {
hotelId: string hotelId: string
} }
// Slugs that are not set elsewhere (dynamically or from CS)
export enum SidepeekSlugs {
about = "about",
amenities = "amenities",
restaurant = "restaurant-and-bar",
meetings = "meetings-and-conferences",
wellness = "wellness-and-exercise",
}

View File

@@ -1,11 +1,3 @@
import {
meetingsAndConferences,
restaurantAndBar,
wellnessAndExercise,
} from "@/constants/routes/hotelPageParams"
import { getLang } from "@/i18n/serverContext"
import { import {
type Facilities, type Facilities,
type FacilityCard, type FacilityCard,
@@ -18,6 +10,8 @@ import {
RestaurantHeadings, RestaurantHeadings,
WellnessHeadings, WellnessHeadings,
} from "@/types/components/hotelPage/facilities" } from "@/types/components/hotelPage/facilities"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
import { FacilityEnum } from "@/types/enums/facilities" import { FacilityEnum } from "@/types/enums/facilities"
import type { import type {
Amenities, Amenities,
@@ -77,8 +71,9 @@ export function isFacilityImage(card: FacilityCardType): card is FacilityImage {
function setCardProps( function setCardProps(
theme: CardProps["theme"], theme: CardProps["theme"],
buttonText: (typeof FacilityCardButtonText)[keyof typeof FacilityCardButtonText], buttonText: (typeof FacilityCardButtonText)[keyof typeof FacilityCardButtonText],
href: string, href: HotelHashValues,
heading: string, heading: string,
slug: SidepeekSlugs,
scriptedTopTitle?: string scriptedTopTitle?: string
): FacilityCard { ): FacilityCard {
return { return {
@@ -87,7 +82,7 @@ function setCardProps(
heading, heading,
scriptedTopTitle, scriptedTopTitle,
secondaryButton: { secondaryButton: {
href: `#s-${href}`, href: `#s-${slug}`,
title: buttonText, title: buttonText,
isExternal: false, isExternal: false,
scrollOnClick: false, scrollOnClick: false,
@@ -100,8 +95,6 @@ export function setFacilityCardGrids(
amenities: Amenities, amenities: Amenities,
healthFacilities: HealthFacilities healthFacilities: HealthFacilities
): Facilities { ): Facilities {
const lang = getLang()
const cards: Facilities = facilities const cards: Facilities = facilities
.filter((fac) => !!fac.headingText) .filter((fac) => !!fac.headingText)
.map((facility) => { .map((facility) => {
@@ -133,8 +126,9 @@ export function setFacilityCardGrids(
card = setCardProps( card = setCardProps(
"one", "one",
FacilityCardButtonText.WELLNESS, FacilityCardButtonText.WELLNESS,
wellnessAndExercise[lang], HotelHashValues.wellness,
facility.headingText, facility.headingText,
SidepeekSlugs.wellness,
wellnessTitle wellnessTitle
) )
grid.unshift(card) grid.unshift(card)
@@ -144,8 +138,9 @@ export function setFacilityCardGrids(
card = setCardProps( card = setCardProps(
"primaryDim", "primaryDim",
FacilityCardButtonText.MEETINGS, FacilityCardButtonText.MEETINGS,
meetingsAndConferences[lang], HotelHashValues.meetings,
facility.headingText, facility.headingText,
SidepeekSlugs.meetings,
"Events that make an impression" "Events that make an impression"
) )
grid.push(card) grid.push(card)
@@ -156,8 +151,9 @@ export function setFacilityCardGrids(
card = setCardProps( card = setCardProps(
"primaryDark", "primaryDark",
FacilityCardButtonText.RESTAURANT, FacilityCardButtonText.RESTAURANT,
restaurantAndBar[lang], HotelHashValues.restaurant,
facility.headingText, facility.headingText,
SidepeekSlugs.restaurant,
restaurantTitle restaurantTitle
) )
grid.unshift(card) grid.unshift(card)