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

@@ -1,12 +1,5 @@
import { env } from "@/env/server"
import CurrentLoadingSpinner from "@/components/Current/LoadingSpinner"
import LoadingSpinner from "@/components/LoadingSpinner"
export default function Loading() {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return <CurrentLoadingSpinner />
}
return <LoadingSpinner />
}

View File

@@ -1,8 +1,5 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { env } from "@/env/server"
import DestinationCityPage from "@/components/ContentType/DestinationPage/DestinationCityPage"
import DestinationCityPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCityPage/DestinationCityPageSkeleton"
@@ -14,10 +11,6 @@ export default async function DestinationCityPagePage(
props: PageArgs<{}, { view?: "map"; filterFromUrl?: string }>
) {
const searchParams = await props.searchParams
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
return (
<Suspense fallback={<DestinationCityPageSkeleton />}>
<DestinationCityPage

View File

@@ -1,8 +1,5 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { env } from "@/env/server"
import DestinationCountryPage from "@/components/ContentType/DestinationPage/DestinationCountryPage"
import DestinationCountryPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCountryPage/DestinationCountryPageSkeleton"
@@ -14,10 +11,6 @@ export default async function DestinationCountryPagePage(
props: PageArgs<LangParams, { view?: "map"; filterFromUrl?: string }>
) {
const searchParams = await props.searchParams
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
return (
<Suspense fallback={<DestinationCountryPageSkeleton />}>
<DestinationCountryPage

View File

@@ -1,7 +1,3 @@
import { notFound } from "next/navigation"
import { env } from "@/env/server"
import DestinationOverviewPage from "@/components/ContentType/DestinationPage/DestinationOverviewPage"
import type { LangParams, PageArgs } from "@/types/params"
@@ -9,9 +5,5 @@ import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default function DestinationOverviewPagePage({}: PageArgs<LangParams>) {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
return <DestinationOverviewPage />
}

View File

@@ -1,6 +1,5 @@
import { notFound } from "next/navigation"
import { env } from "@/env/server"
import { getHotelPage } from "@/lib/trpc/memoizedRequests"
import HotelMapPage from "@/components/ContentType/HotelMapPage"
@@ -15,10 +14,6 @@ export default async function HotelPagePage(
props: PageArgs<{}, { subpage?: string; view?: "map" }>
) {
const searchParams = await props.searchParams
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
const hotelPageData = await getHotelPage()
if (!hotelPageData) {

View File

@@ -1,7 +1,3 @@
import { notFound } from "next/navigation"
import { env } from "@/env/server"
import StartPage from "@/components/ContentType/StartPage"
import { parseBookingWidgetSearchParams } from "@/utils/url"
@@ -13,10 +9,6 @@ export default async function StartPagePage(
props: PageArgs<{}, NextSearchParams>
) {
const searchParams = await props.searchParams
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return notFound()
}
const booking = parseBookingWidgetSearchParams(searchParams)
return <StartPage booking={booking} />

View File

@@ -1,13 +1,8 @@
import { env } from "@/env/server"
import type { LangParams, PageArgs } from "@/types/params"
export async function generateMetadata(props: PageArgs<LangParams>) {
const params = await props.params;
export async function generateMetadata() {
return {
robots: {
index: env.isLangLive(params.lang),
follow: env.isLangLive(params.lang),
index: true,
follow: true,
},
}
}

View File

@@ -1,4 +1,3 @@
import { env } from "@/env/server"
import { getDestinationCityPage } from "@/lib/trpc/memoizedRequests"
import { BookingWidget } from "@/components/BookingWidget"
@@ -10,9 +9,6 @@ export default async function BookingWidgetDestinationCityPage(
props: PageArgs<{}, NextSearchParams>
) {
const searchParams = await props.searchParams
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return null
}
const { bookingCode } = searchParams
const pageData = await getDestinationCityPage()

View File

@@ -1,4 +1,3 @@
import { env } from "@/env/server"
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
import { BookingWidget } from "@/components/BookingWidget"
@@ -11,9 +10,6 @@ export default async function BookingWidgetHotelPage(
props: PageArgs<{}, NextSearchParams & { subpage?: string }>
) {
const searchParams = await props.searchParams
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
return null
}
const hotelPageData = await getHotelPage()
const hotelData = await getHotel({

View File

@@ -1,5 +1,3 @@
import { env } from "@/env/server"
import { BookingWidget } from "@/components/BookingWidget"
import { parseBookingWidgetSearchParams } from "@/utils/url"
@@ -8,11 +6,7 @@ import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
export default async function BookingWidgetPage(
props: PageArgs<LangParams, NextSearchParams>
) {
const params = await props.params
const searchParams = await props.searchParams
if (!env.isLangLive(params.lang)) {
return null
}
const booking = parseBookingWidgetSearchParams(searchParams)

View File

@@ -8,7 +8,6 @@ import Script from "next/script"
import { Lang } from "@scandic-hotels/common/constants/language"
import { env } from "@/env/server"
import TrpcProvider from "@/lib/trpc/Provider"
import TokenRefresher from "@/components/Auth/TokenRefresher"
@@ -32,9 +31,6 @@ export default async function RootLayout(
const { children } = props
if (!env.SAS_ENABLED) {
return null
}
setLang(params.lang)
const messages = await getMessages(params.lang)

View File

@@ -1,7 +1,5 @@
import { notFound } from "next/navigation"
import { env } from "@/env/server"
import { getSitemapDataById } from "@/utils/sitemap"
import type { NextRequest } from "next/server"
@@ -12,10 +10,6 @@ export async function GET(
_request: NextRequest,
context: { params: Promise<{ sitemapId: string }> }
) {
if (env.NEW_SITE_LIVE_STATUS !== "ALL_LANGUAGES_LIVE") {
return notFound()
}
const params = await context.params
const sitemapId = params.sitemapId

View File

@@ -1,5 +1,3 @@
import { notFound } from "next/navigation"
import { env } from "@/env/server"
import { getLastUpdated, getSitemapIds } from "@/utils/sitemap"
@@ -7,10 +5,6 @@ import { getLastUpdated, getSitemapIds } from "@/utils/sitemap"
export const dynamic = "force-dynamic"
export async function GET() {
if (env.NEW_SITE_LIVE_STATUS !== "ALL_LANGUAGES_LIVE") {
return notFound()
}
console.log(`[SITEMAP] Fetching sitemap`)
const lastUpdated = await getLastUpdated()