feat(SW-1389): refactor page settings

This commit is contained in:
Michael Zetterberg
2025-02-17 06:15:21 +01:00
parent 504fe7cb99
commit 82ba219e2b
18 changed files with 203 additions and 181 deletions

View File

@@ -1,6 +1,7 @@
import { getLocations, getSiteConfig } from "@/lib/trpc/memoizedRequests"
import { getLang } from "@/i18n/serverContext"
import {
getLocations,
isBookingWidgetHidden,
} from "@/lib/trpc/memoizedRequests"
import BookingWidgetClient from "./Client"
@@ -14,11 +15,15 @@ export default async function BookingWidget({
type,
bookingWidgetSearchParams,
}: BookingWidgetProps) {
const lang = await getLang()
const locations = await getLocations()
const siteConfig = await getSiteConfig(lang)
const isHidden = await isBookingWidgetHidden()
if (!locations || "error" in locations || siteConfig?.bookingWidgetDisabled) {
if (isHidden) {
return null
}
const locations = await getLocations()
if (!locations || "error" in locations) {
return null
}