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:
@@ -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 />
|
||||
}
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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} />
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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}</>
|
||||
}
|
||||
|
||||
@@ -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}/`)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { env } from "@/env/server"
|
||||
import { getDestinationCityPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { BookingWidget } from "@/components/BookingWidget"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
import type { PageArgs } from "@/types/params"
|
||||
@@ -9,9 +9,10 @@ import type { PageArgs } from "@/types/params"
|
||||
export default async function BookingWidgetDestinationCityPage({
|
||||
searchParams,
|
||||
}: PageArgs<{}, BookingWidgetSearchData>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
|
||||
return null
|
||||
}
|
||||
|
||||
const { bookingCode } = searchParams
|
||||
const pageData = await getDestinationCityPage()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { env } from "@/env/server"
|
||||
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { BookingWidget } from "@/components/BookingWidget"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
@@ -10,9 +10,10 @@ import type { PageArgs } from "@/types/params"
|
||||
export default async function BookingWidgetHotelPage({
|
||||
searchParams,
|
||||
}: PageArgs<{}, BookingWidgetSearchData & { subpage?: string }>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
|
||||
return null
|
||||
}
|
||||
|
||||
const { bookingCode, subpage } = searchParams
|
||||
|
||||
const hotelPageData = await getHotelPage()
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import { BookingWidgetSkeleton } from "@/components/BookingWidget/Client"
|
||||
|
||||
export default function LoadingBookingWidget() {
|
||||
if (!env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <BookingWidgetSkeleton />
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { BookingWidget } from "@/components/BookingWidget"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
@@ -8,7 +8,7 @@ import type { LangParams, PageArgs } from "@/types/params"
|
||||
export default async function BookingWidgetPage({
|
||||
searchParams,
|
||||
}: PageArgs<LangParams, BookingWidgetSearchData>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH) {
|
||||
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import { BookingWidgetSkeleton } from "@/components/BookingWidget/Client"
|
||||
|
||||
export default function LoadingBookingWidget() {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <BookingWidgetSkeleton />
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { BookingWidget } from "@/components/BookingWidget"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
import type { PageArgs } from "@/types/params"
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
export default async function BookingWidgetPage({
|
||||
searchParams,
|
||||
}: PageArgs<{}, BookingWidgetSearchData>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
params,
|
||||
}: PageArgs<LangParams, BookingWidgetSearchData>) {
|
||||
if (!env.isLangLive(params.lang)) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -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}</>
|
||||
}
|
||||
|
||||
@@ -172,7 +172,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(params.lang)
|
||||
? new URL(getCurrentWebUrl({ path: "/", lang }))
|
||||
: new URL(`${baseUrl}/${lang}/`)
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ export async function GET(
|
||||
_request: NextRequest,
|
||||
context: { params: { sitemapId: string } }
|
||||
) {
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
notFound()
|
||||
if (env.NEW_SITE_LIVE_STATUS !== "ALL_LANGUAGES_LIVE") {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const sitemapId = context.params.sitemapId
|
||||
@@ -21,12 +21,12 @@ export async function GET(
|
||||
console.log("[SITEMAP] Fetching sitemap by ID", sitemapId)
|
||||
|
||||
if (!sitemapId) {
|
||||
notFound()
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const sitemapData = await getSitemapDataById(Number(sitemapId))
|
||||
if (!sitemapData.length) {
|
||||
notFound()
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const entries = sitemapData.map((entry) => {
|
||||
|
||||
@@ -7,8 +7,8 @@ import { getLastUpdated, getSitemapIds } from "@/utils/sitemap"
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export async function GET() {
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
notFound()
|
||||
if (env.NEW_SITE_LIVE_STATUS !== "ALL_LANGUAGES_LIVE") {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
console.log(`[SITEMAP] Fetching sitemap`)
|
||||
|
||||
Reference in New Issue
Block a user