From 85a925f281ce72e6df9b2f592b0eb193d2a4ef2d Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Wed, 1 Oct 2025 07:52:17 +0000 Subject: [PATCH] Merged in fix/make-promohero-signup-button-client-component (pull request #2889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: make promo hero signup cta client component * fix: make promo hero signup cta client component Approved-by: Matilda Landström --- .../Hero/PromoSignUpButton.tsx | 37 +++++++++++++++++++ .../PromoCampaignPage/Hero/index.tsx | 27 +------------- 2 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoSignUpButton.tsx diff --git a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoSignUpButton.tsx b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoSignUpButton.tsx new file mode 100644 index 000000000..947a4619f --- /dev/null +++ b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoSignUpButton.tsx @@ -0,0 +1,37 @@ +"use client" + +import { useIntl } from "react-intl" + +import { signup } from "@scandic-hotels/common/constants/routes/signup" +import ButtonLink from "@scandic-hotels/design-system/ButtonLink" +import { trackEvent } from "@scandic-hotels/tracking/base" + +import useLang from "@/hooks/useLang" + +export default function PromoSignUpButton() { + const lang = useLang() + const intl = useIntl() + + return ( + + trackEvent({ + event: "signupStart", + signUp: { + position: "campaign banner signup cta", + action: "signup start", + ctaName: "signup", + }, + }) + } + href={signup[lang]} + variant="Secondary" + color="Inverted" + size="Medium" + > + {intl.formatMessage({ + defaultMessage: "Sign up", + })} + + ) +} diff --git a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx index 2217619f1..0abbf99b4 100644 --- a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx +++ b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx @@ -1,21 +1,18 @@ import { cx } from "class-variance-authority" -import { signup } from "@scandic-hotels/common/constants/routes/signup" -import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Image from "@scandic-hotels/design-system/Image" import { Typography } from "@scandic-hotels/design-system/Typography" -import { trackEvent } from "@scandic-hotels/tracking/base" import { getProfileSafely } from "@/lib/trpc/memoizedRequests" import { getIntl } from "@/i18n" -import { getLang } from "@/i18n/serverContext" import ActivateOffer from "./ActivateOffer" import IneligibleMessage from "./IneligibleMessage" import PromoLoginButton from "./PromoLoginButton" +import PromoSignUpButton from "./PromoSignUpButton" import { isUserEligibleForPromo } from "./utils" import styles from "./hero.module.css" @@ -40,7 +37,6 @@ export default async function PromoCampaignHero({ ...props }: PromoCampaignHeroProps) { const intl = await getIntl() - const lang = await getLang() const profile = await getProfileSafely() const { image, heading, benefits } = promoHero @@ -148,26 +144,7 @@ export default async function PromoCampaignHero({ - - trackEvent({ - event: "signupStart", - signUp: { - position: "campaign banner signup cta", - action: "signup start", - ctaName: "signup", - }, - }) - } - href={signup[lang]} - variant="Secondary" - color="Inverted" - size="Medium" - > - {intl.formatMessage({ - defaultMessage: "Sign up", - })} - + )}