Merged in fix/SW-2068-correct-public-url-from-my-stays-overview-page (pull request #1694)

feat(SW-2068): Link to Correct Public URL from within My Stays Overview Page

* feat(SW-2068): Link to Correct Public URL from within My Stays Overview Page

- Added language parameter to previous and upcoming stays queries.
- Updated Client components to utilize the new language hook.
- Refactored EmptyUpcomingStays component to dynamically generate links based on the current language.
- Adjusted user input validation to include optional language parameter.

* refactor(SW-2068): Update EmptyUpcomingStays components to use PUBLIC_URL + add utility to handle TLD based on language

* chore(SW-2068): Clarify TLD

* feat(SW-2068): documentation for getTldForLanguage

* refactor(SW-2068): Simplify booking URL construction in updateStaysBookingUrl

* refactor(SW-2068): Remove incorrect TLD update logic from booking URL construction

* refactor(SW-2068): Centralize booking URL paths using myBookingPath constant

* refactor(SW-2068): Streamline search params in booking URL construction logic in updateStaysBookingUrl


Approved-by: Christian Andolf
This commit is contained in:
Chuma Mcphoy (We Ahead)
2025-04-02 12:44:02 +00:00
parent 67905198c6
commit 56d5ad77d1
6 changed files with 109 additions and 89 deletions

View File

@@ -1,17 +1,23 @@
import { MaterialIcon } from "@scandic-hotels/design-system/Icons"
import { homeHrefs } from "@/constants/homeHrefs"
import { env } from "@/env/server"
import Link from "@/components/TempDesignSystem/Link"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { getCurrentWebUrl } from "@/utils/url"
import styles from "./emptyUpcomingStays.module.css"
export default async function EmptyUpcomingStaysBlock() {
const intl = await getIntl()
const lang = getLang()
const href = env.HIDE_FOR_NEXT_RELEASE
? getCurrentWebUrl("/", lang)
: `/${lang}`
return (
<section className={styles.container}>
<div className={styles.titleContainer}>
@@ -28,11 +34,7 @@ export default async function EmptyUpcomingStaysBlock() {
</span>
</Title>
</div>
<Link
href={homeHrefs[env.NODE_ENV][getLang()]}
className={styles.link}
color="peach80"
>
<Link href={href} className={styles.link} color="peach80">
{intl.formatMessage({ id: "Get inspired" })}
<MaterialIcon icon="arrow_forward" color="CurrentColor" />
</Link>

View File

@@ -1,17 +1,23 @@
import { MaterialIcon } from "@scandic-hotels/design-system/Icons"
import { homeHrefs } from "@/constants/homeHrefs"
import { env } from "@/env/server"
import Link from "@/components/TempDesignSystem/Link"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { getCurrentWebUrl } from "@/utils/url"
import styles from "./emptyUpcomingStays.module.css"
export default async function EmptyUpcomingStaysBlock() {
const intl = await getIntl()
const lang = getLang()
const href = env.HIDE_FOR_NEXT_RELEASE
? getCurrentWebUrl("/", lang)
: `/${lang}`
return (
<section className={styles.container}>
<div className={styles.titleContainer}>
@@ -28,14 +34,9 @@ export default async function EmptyUpcomingStaysBlock() {
</span>
</Title>
</div>
<Link
href={homeHrefs[env.NODE_ENV][getLang()]}
className={styles.link}
color="peach80"
>
<Link href={href} className={styles.link} color="peach80">
{intl.formatMessage({ id: "Get inspired" })}
<MaterialIcon color="CurrentColor" icon="arrow_forward" />
<MaterialIcon icon="arrow_forward" color="CurrentColor" />
</Link>
</section>
)