Merged in feature/SW-2320-languagebased-hide-for-next-release (pull request #1937)
Language based alternative to HIDE_FOR_NEXT_RELEASE Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -15,7 +15,7 @@ export default async function EmptyUpcomingStaysBlock() {
|
||||
const lang = getLang()
|
||||
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
|
||||
|
||||
const href = env.HIDE_FOR_NEXT_RELEASE
|
||||
const href = !env.isLangLive(lang)
|
||||
? getCurrentWebUrl({ path: "/", lang, baseUrl })
|
||||
: `/${lang}`
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export default async function EmptyUpcomingStaysBlock() {
|
||||
const lang = getLang()
|
||||
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
|
||||
|
||||
const href = env.HIDE_FOR_NEXT_RELEASE
|
||||
const href = !env.isLangLive(lang)
|
||||
? getCurrentWebUrl({ path: "/", lang, baseUrl })
|
||||
: `/${lang}`
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ function DynamicContentBlocks(props: DynamicContentProps) {
|
||||
case DynamicContentEnum.Blocks.components.earn_and_burn:
|
||||
return <EarnAndBurn {...dynamic_content} />
|
||||
case DynamicContentEnum.Blocks.components.expiring_points:
|
||||
return env.HIDE_FOR_NEXT_RELEASE ? null : (
|
||||
return env.NEW_SITE_LIVE_STATUS === "NOT_LIVE" ? null : (
|
||||
<ExpiringPoints {...dynamic_content} />
|
||||
)
|
||||
case DynamicContentEnum.Blocks.components.how_it_works:
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import {
|
||||
getPageSettingsBookingCode,
|
||||
isBookingWidgetHidden,
|
||||
} from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidgetClient from "./Client"
|
||||
import BookingWidgetClient, { BookingWidgetSkeleton } from "./Client"
|
||||
|
||||
import type { BookingWidgetProps } from "@/types/components/bookingWidget"
|
||||
|
||||
export default async function BookingWidget({
|
||||
export async function BookingWidget(props: BookingWidgetProps) {
|
||||
return (
|
||||
<Suspense fallback={<BookingWidgetSkeleton />}>
|
||||
<InternalBookingWidget {...props} />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
async function InternalBookingWidget({
|
||||
type,
|
||||
bookingWidgetSearchParams,
|
||||
}: BookingWidgetProps) {
|
||||
|
||||
@@ -2,6 +2,7 @@ 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"
|
||||
@@ -13,7 +14,8 @@ export function preload() {
|
||||
}
|
||||
|
||||
export default function Footer() {
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
const lang = getLang()
|
||||
if (!env.isLangLive(lang)) {
|
||||
return <CurrentFooter />
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ 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 { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
@@ -32,6 +33,7 @@ export default function MobileMenu({
|
||||
topLink,
|
||||
isLoggedIn,
|
||||
}: React.PropsWithChildren<MobileMenuProps>) {
|
||||
const isLangLive = useIsLangLive()
|
||||
const lang = useLang()
|
||||
const intl = useIntl()
|
||||
const {
|
||||
@@ -76,7 +78,7 @@ export default function MobileMenu({
|
||||
})
|
||||
|
||||
const baseUrl = env.NEXT_PUBLIC_PUBLIC_URL || "https://www.scandichotels.com"
|
||||
const findMyBookingUrl = env.NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE
|
||||
const findMyBookingUrl = !isLangLive
|
||||
? getCurrentWebUrl({
|
||||
path: findMyBookingCurrentWebPath[lang],
|
||||
lang,
|
||||
|
||||
@@ -34,7 +34,7 @@ export default async function TopMenu() {
|
||||
|
||||
const lang = getLang()
|
||||
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
|
||||
const findMyBookingUrl = env.HIDE_FOR_NEXT_RELEASE
|
||||
const findMyBookingUrl = !env.isLangLive(lang)
|
||||
? getCurrentWebUrl({
|
||||
path: findMyBookingCurrentWebPath[lang],
|
||||
lang,
|
||||
|
||||
@@ -4,6 +4,7 @@ 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"
|
||||
@@ -14,7 +15,8 @@ import styles from "./header.module.css"
|
||||
export default function Header() {
|
||||
void getName()
|
||||
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
const lang = getLang()
|
||||
if (!env.isLangLive(lang)) {
|
||||
return (
|
||||
<Suspense fallback={<HeaderFallback />}>
|
||||
<CurrentHeader />
|
||||
|
||||
@@ -28,9 +28,6 @@ export default function LanguageSwitcherContent({
|
||||
const urlKeys = Object.keys(urls) as Lang[]
|
||||
|
||||
const pathname = usePathname()
|
||||
const relValue = env.NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE
|
||||
? "nofollow"
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<div className={styles.languageWrapper}>
|
||||
@@ -43,13 +40,14 @@ export default function LanguageSwitcherContent({
|
||||
{urlKeys.map((key) => {
|
||||
const url = urls[key]?.url
|
||||
const isActive = currentLanguage === key
|
||||
|
||||
if (url) {
|
||||
return (
|
||||
<li key={key}>
|
||||
<Link
|
||||
className={`${styles.link} ${isActive ? styles.active : ""}`}
|
||||
href={replaceUrlPart(pathname, url)}
|
||||
rel={relValue}
|
||||
rel={env.isLangLive(key) ? undefined : "nofollow"}
|
||||
onClick={onLanguageSwitch}
|
||||
keepSearchParams
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user