Merged in chore/remove-unused-env-vars (pull request #2463)

chore: Remove unused env vars and feature toggles

* Remove unused env vars and feature toggles


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-06-30 07:48:05 +00:00
parent bdf66af23d
commit f0def99425
38 changed files with 28 additions and 369 deletions

View File

@@ -10,7 +10,6 @@ import {
SAS_EUROBONUS_TIER_TO_NAME_MAP,
TIER_TO_FRIEND_MAP,
} from "@/constants/membershipLevels"
import { env } from "@/env/server"
import { getProfileWithExtendedPartnerData } from "@/lib/trpc/memoizedRequests"
import SectionContainer from "@/components/Section/Container"
@@ -36,10 +35,6 @@ export default async function SASLinkedAccount({
subtitle,
link,
}: Props) {
if (!env.SAS_ENABLED) {
return null
}
const intl = await getIntl()
return (

View File

@@ -23,7 +23,7 @@ export default async function SASTransferPoints({
subtitle,
link,
}: Props) {
if (!env.SAS_ENABLED || !env.SAS_POINT_TRANSFER_ENABLED) {
if (!env.SAS_POINT_TRANSFER_ENABLED) {
return null
}

View File

@@ -1,8 +1,5 @@
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { env } from "@/env/server"
import Link from "@/components/TempDesignSystem/Link"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
@@ -13,11 +10,8 @@ import styles from "./emptyUpcomingStays.module.css"
export default async function EmptyUpcomingStaysBlock() {
const intl = await getIntl()
const lang = await getLang()
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
const href = !env.isLangLive(lang)
? getCurrentWebUrl({ path: "/", lang, baseUrl })
: `/${lang}`
const href = `/${lang}`
return (
<section className={styles.container}>

View File

@@ -2,8 +2,6 @@ import { Suspense } from "react"
import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent"
import { env } from "@/env/server"
import HowItWorks from "@/components/Blocks/DynamicContent/HowItWorks"
import LoyaltyLevels from "@/components/Blocks/DynamicContent/LoyaltyLevels"
import Overview from "@/components/Blocks/DynamicContent/Overview"
@@ -41,9 +39,7 @@ function DynamicContentBlocks(props: DynamicContentProps) {
case DynamicContentEnum.Blocks.components.earn_and_burn:
return <EarnAndBurn {...dynamic_content} />
case DynamicContentEnum.Blocks.components.expiring_points:
return env.NEW_SITE_LIVE_STATUS === "NOT_LIVE" ? null : (
<ExpiringPoints {...dynamic_content} />
)
return <ExpiringPoints {...dynamic_content} />
case DynamicContentEnum.Blocks.components.how_it_works:
return <HowItWorks dynamic_content={dynamic_content} />
case DynamicContentEnum.Blocks.components.jobylon_feed:

View File

@@ -4,7 +4,6 @@
import { useCallback, useEffect, useRef, useState } from "react"
import { languages } from "@/constants/languages"
import { env } from "@/env/client"
import Link from "@/components/TempDesignSystem/Link"
import useLang from "@/hooks/useLang"
@@ -84,19 +83,11 @@ export default function Desktop({ urls }: LanguageSwitcherProps) {
className={`${styles.li} ${currentLanguage === key ? styles.active : ""}`}
>
{urls[key as Lang]?.isExternal ? (
<Link
className={styles.link}
href={url}
rel={env.isLangLive(key as Lang) ? undefined : "nofollow"}
>
<Link className={styles.link} href={url}>
{languages[key as Lang]}
</Link>
) : (
<a
className={styles.link}
href={url}
rel={env.isLangLive(key as Lang) ? undefined : "nofollow"}
>
<a className={styles.link} href={url}>
{languages[key as Lang]}
</a>
)}

View File

@@ -4,7 +4,6 @@
import { useState } from "react"
import { languages } from "@/constants/languages"
import { env } from "@/env/client"
import useLang from "@/hooks/useLang"
@@ -47,11 +46,7 @@ export default function Mobile({ urls }: LanguageSwitcherProps) {
if (url) {
return (
<li key={key} className={styles.li}>
<a
href={url}
className={styles.link}
rel={env.isLangLive(key as Lang) ? undefined : "nofollow"}
>
<a href={url} className={styles.link}>
{languages[key as Lang]}
</a>
</li>

View File

@@ -1,9 +1,5 @@
import { env } from "@/env/server"
import { getFooter } from "@/lib/trpc/memoizedRequests"
import CurrentFooter from "@/components/Current/Footer"
import { getLang } from "@/i18n/serverContext"
import FooterDetails from "./Details"
import FooterNavigation from "./Navigation"
@@ -14,11 +10,6 @@ export function preload() {
}
export default async function Footer() {
const lang = await getLang()
if (!env.isLangLive(lang)) {
return <CurrentFooter />
}
preload()
return (

View File

@@ -5,20 +5,14 @@ import { Dialog, Modal } from "react-aria-components"
import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts"
import {
findMyBooking,
findMyBookingCurrentWebPath,
} from "@scandic-hotels/common/constants/routes/findMyBooking"
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking"
import { customerService } from "@/constants/webHrefs"
import { env } from "@/env/client"
import useDropdownStore from "@/stores/main-menu"
import { IconName } from "@/components/Icons/iconName"
import LanguageSwitcher from "@/components/LanguageSwitcher"
import { useHandleKeyUp } from "@/hooks/useHandleKeyUp"
import { useIsLangLive } from "@/hooks/useIsLangLive"
import useLang from "@/hooks/useLang"
import HeaderLink from "../../HeaderLink"
@@ -34,7 +28,6 @@ export default function MobileMenu({
topLink,
isLoggedIn,
}: React.PropsWithChildren<MobileMenuProps>) {
const isLangLive = useIsLangLive()
const lang = useLang()
const intl = useIntl()
const {
@@ -78,14 +71,7 @@ export default function MobileMenu({
defaultMessage: "Open menu",
})
const baseUrl = env.NEXT_PUBLIC_PUBLIC_URL || "https://www.scandichotels.com"
const findMyBookingUrl = !isLangLive
? getCurrentWebUrl({
path: findMyBookingCurrentWebPath[lang],
lang,
baseUrl,
})
: findMyBooking[lang]
const findMyBookingUrl = findMyBooking[lang]
return (
<>

View File

@@ -1,10 +1,5 @@
import {
findMyBooking,
findMyBookingCurrentWebPath,
} from "@scandic-hotels/common/constants/routes/findMyBooking"
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking"
import { env } from "@/env/server"
import { getHeader } from "@/lib/trpc/memoizedRequests"
import { IconName } from "@/components/Icons/iconName"
@@ -31,14 +26,7 @@ export default async function TopMenu() {
}
const lang = await getLang()
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
const findMyBookingUrl = !env.isLangLive(lang)
? getCurrentWebUrl({
path: findMyBookingCurrentWebPath[lang],
lang,
baseUrl,
})
: findMyBooking[lang]
const findMyBookingUrl = findMyBooking[lang]
return (
<div className={styles.topMenu}>

View File

@@ -1,12 +1,7 @@
import { Suspense } from "react"
import { env } from "@/env/server"
import { getHeader, getName } from "@/lib/trpc/memoizedRequests"
import CurrentHeader from "@/components/Current/Header"
import { getLang } from "@/i18n/serverContext"
import HeaderFallback from "../Current/Header/HeaderFallback"
import MainMenu from "./MainMenu"
import TopMenu, { TopMenuSkeleton } from "./TopMenu"
@@ -14,16 +9,6 @@ import styles from "./header.module.css"
export default async function Header() {
void getName()
const lang = await getLang()
if (!env.isLangLive(lang)) {
return (
<Suspense fallback={<HeaderFallback />}>
<CurrentHeader />
</Suspense>
)
}
void getHeader()
return (

View File

@@ -3,7 +3,6 @@ import { notFound } from "next/navigation"
import { dt } from "@scandic-hotels/common/dt"
import * as maskValue from "@scandic-hotels/common/utils/maskValue"
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
import { parseRefId } from "@scandic-hotels/trpc/utils/refId"
@@ -169,9 +168,7 @@ export default async function MyStay(props: {
hotel.galleryImages[0]?.imageSizes.large
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
const promoUrl = !env.isLangLive(lang)
? new URL(getCurrentWebUrl({ path: "/", lang }))
: new URL(`${baseUrl}/${lang}/`)
const promoUrl = new URL(`${baseUrl}/${lang}/`)
promoUrl.searchParams.set("hotel", hotel.operaId)

View File

@@ -7,7 +7,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { languages } from "@/constants/languages"
import { env } from "@/env/client"
import Link from "@/components/TempDesignSystem/Link"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
@@ -57,7 +56,6 @@ export default function LanguageSwitcherContent({
<Link
className={styles.link}
href={replaceUrlPart(pathname, url)}
rel={env.isLangLive(key) ? undefined : "nofollow"}
onClick={() => onLanguageSwitch(key)}
variant="languageSwitcher"
keepSearchParams