Refactor: removed parallel routes for header, footer and sidewidealert. Langswitcher and sidewidealert now client components * feat - removed parallel routes and made sidepeek and sitewidealerts as client components * Langswitcher as client component * Fixed lang switcher for current header * Passing lang when fetching siteconfig * Merge branch 'master' into feat/refactor-header-footer-sitewidealert * Refactor * Removed dead code * Show only languages that has translation * Refetch sitewidealert every 60 seconds * Merge branch 'master' into feat/refactor-header-footer-sitewidealert * Removed sidepeek parallel route from my-stay * Added missing env.var to env.test * Removed console.log Approved-by: Joakim Jäderberg
33 lines
786 B
TypeScript
33 lines
786 B
TypeScript
import { getLocations, getSiteConfig } from "@/lib/trpc/memoizedRequests"
|
|
|
|
import { getLang } from "@/i18n/serverContext"
|
|
|
|
import BookingWidgetClient from "./Client"
|
|
|
|
import type { BookingWidgetProps } from "@/types/components/bookingWidget"
|
|
|
|
export function preload() {
|
|
void getLocations()
|
|
}
|
|
|
|
export default async function BookingWidget({
|
|
type,
|
|
bookingWidgetSearchParams,
|
|
}: BookingWidgetProps) {
|
|
const lang = await getLang()
|
|
const locations = await getLocations()
|
|
const siteConfig = await getSiteConfig(lang)
|
|
|
|
if (!locations || "error" in locations || siteConfig?.bookingWidgetDisabled) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<BookingWidgetClient
|
|
locations={locations.data}
|
|
type={type}
|
|
bookingWidgetSearchParams={bookingWidgetSearchParams}
|
|
/>
|
|
)
|
|
}
|