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:
Joakim Jäderberg
2025-05-05 10:53:28 +00:00
parent 3bcf6cff4a
commit 5784822a1e
41 changed files with 232 additions and 133 deletions

View File

@@ -4,8 +4,9 @@ import CurrentLoadingSpinner from "@/components/Current/LoadingSpinner"
import LoadingSpinner from "@/components/LoadingSpinner"
export default function Loading() {
if (env.HIDE_FOR_NEXT_RELEASE) {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return <CurrentLoadingSpinner />
}
return <LoadingSpinner />
}

View File

@@ -13,8 +13,8 @@ export { generateMetadata } from "@/utils/generateMetadata"
export default function DestinationCityPagePage({
searchParams,
}: PageArgs<{}, { view?: "map" }>) {
if (env.HIDE_FOR_NEXT_RELEASE) {
notFound()
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
return (

View File

@@ -6,16 +6,16 @@ import { env } from "@/env/server"
import DestinationCountryPage from "@/components/ContentType/DestinationPage/DestinationCountryPage"
import DestinationCountryPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCountryPage/DestinationCountryPageSkeleton"
import type { PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export default function DestinationCountryPagePage({}: PageArgs<
{},
LangParams,
{ view?: "map" }
>) {
if (env.HIDE_FOR_NEXT_RELEASE) {
notFound()
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
return (

View File

@@ -4,10 +4,12 @@ import { env } from "@/env/server"
import DestinationOverviewPage from "@/components/ContentType/DestinationPage/DestinationOverviewPage"
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export default function DestinationOverviewPagePage() {
if (env.HIDE_FOR_NEXT_RELEASE) {
export default function DestinationOverviewPagePage({}: PageArgs<LangParams>) {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}

View File

@@ -14,13 +14,14 @@ export { generateMetadata } from "@/utils/generateMetadata"
export default async function HotelPagePage({
searchParams,
}: PageArgs<{}, { subpage?: string; view?: "map" }>) {
if (env.HIDE_FOR_NEXT_RELEASE) {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
const hotelPageData = await getHotelPage()
if (!hotelPageData) {
notFound()
return notFound()
}
if (searchParams.subpage) {

View File

@@ -12,8 +12,9 @@ export { generateMetadata } from "@/utils/generateMetadata"
export default function StartPagePage({
searchParams,
}: PageArgs<{}, BookingWidgetSearchData>) {
if (env.HIDE_FOR_NEXT_RELEASE) {
notFound()
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
return <StartPage searchParams={searchParams} />
}

View File

@@ -11,7 +11,7 @@ import {
import type { LangParams, PageArgs } from "@/types/params"
export default function HotelReservationPage({ params }: PageArgs<LangParams>) {
if (!env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH) {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return null
}

View File

@@ -1,21 +1,22 @@
import { notFound } from "next/navigation"
import { env } from "@/env/server"
import type { Metadata } from "next"
import type { LangParams, PageArgs } from "@/types/params"
export const metadata: Metadata = {
robots: {
index: false,
follow: false,
},
export async function generateMetadata({ params }: PageArgs<LangParams>) {
return {
robots: {
index: env.isLangLive(params.lang),
follow: env.isLangLive(params.lang),
},
}
}
export default function HotelReservationLayout({
children,
}: React.PropsWithChildren) {
if (!env.ENABLE_BOOKING_FLOW) {
return notFound()
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return null
}
return <>{children}</>
}

View File

@@ -175,7 +175,7 @@ export default async function MyStay({
hotel.galleryImages[0]?.imageSizes.large
const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com"
const promoUrl = env.HIDE_FOR_NEXT_RELEASE
const promoUrl = !env.isLangLive(lang)
? new URL(getCurrentWebUrl({ path: "/", lang }))
: new URL(`${baseUrl}/${lang}/`)