feat(SW-962): remove open in new tab key

This commit is contained in:
Fredrik Thorsson
2024-12-03 08:58:16 +01:00
parent f171bf9af7
commit c86bbbc205
5 changed files with 12 additions and 16 deletions

View File

@@ -12,11 +12,11 @@ import styles from "./activities.module.css"
import type { ActivitiesSidePeekProps } from "@/types/components/hotelPage/sidepeek/activities"
export default async function ActivitiesSidePeek({
preamble,
contentPageLink,
contentPage,
}: ActivitiesSidePeekProps) {
const lang = getLang()
const intl = await getIntl()
const { href, preamble } = contentPage
return (
<SidePeek
contentKey={activities[lang]}
@@ -25,7 +25,7 @@ export default async function ActivitiesSidePeek({
<Preamble>{preamble}</Preamble>
<div className={styles.buttonContainer}>
<Button theme="base" intent="secondary" asChild>
<Link href={contentPageLink} color="burgundy" weight="bold">
<Link href={href} color="burgundy" weight="bold">
{intl.formatMessage({ id: "Show activities calendar" })}
</Link>
</Button>

View File

@@ -201,10 +201,7 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
</SidePeek>
<WellnessAndExerciseSidePeek healthFacilities={healthFacilities} />
{activitiesCard && (
<ActivitiesSidePeek
preamble={activitiesCard.preamble}
contentPageLink={activitiesCard.contentPage.href}
/>
<ActivitiesSidePeek contentPage={activitiesCard.contentPage} />
)}
<SidePeek
contentKey={meetingsAndConferences[lang]}

View File

@@ -50,7 +50,6 @@ query GetHotelPage($locale: String!, $uid: String!) {
cta_text
heading
body_text
open_in_new_tab
scripted_title
hotel_page_activities_content_pageConnection {
edges {

View File

@@ -19,7 +19,6 @@ export const activitiesCardSchema = z.object({
body_text: z.string(),
cta_text: z.string(),
heading: z.string(),
open_in_new_tab: z.boolean(),
scripted_title: z.string().optional(),
hotel_page_activities_content_pageConnection: z.object({
edges: z.array(
@@ -36,19 +35,20 @@ export const activitiesCardSchema = z.object({
}),
})
.transform((data) => {
let contentPage = { href: "" }
let preamble = ""
let contentPage = { href: "", preamble: "" }
if (data.hotel_page_activities_content_pageConnection.edges.length) {
const page =
data.hotel_page_activities_content_pageConnection.edges[0].node
preamble = page.header.preamble
if (page.web.original_url) {
contentPage = {
href: page.web.original_url,
preamble: page.header.preamble,
}
} else {
contentPage = {
href: removeMultipleSlashes(`/${page.system.locale}/${page.url}`),
preamble: page.header.preamble,
}
}
}
@@ -58,9 +58,7 @@ export const activitiesCardSchema = z.object({
contentPage,
ctaText: data.cta_text,
heading: data.heading,
openInNewTab: !!data.open_in_new_tab,
scriptedTopTitle: data.scripted_title,
preamble,
}
}),
})

View File

@@ -1,4 +1,6 @@
export type ActivitiesSidePeekProps = {
preamble: string
contentPageLink: string
contentPage: {
href: string
preamble: string
}
}