30 lines
703 B
TypeScript
30 lines
703 B
TypeScript
import { getLocations, getSiteConfig } from "@/lib/trpc/memoizedRequests"
|
|
|
|
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 locations = await getLocations()
|
|
const siteConfig = await getSiteConfig()
|
|
|
|
if (!locations || "error" in locations || siteConfig?.bookingWidgetDisabled) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<BookingWidgetClient
|
|
locations={locations.data}
|
|
type={type}
|
|
bookingWidgetSearchParams={bookingWidgetSearchParams}
|
|
/>
|
|
)
|
|
}
|