import { getLocations } from "@/lib/trpc/memoizedRequests"

import Form from "@/components/Forms/BookingWidget"

import styles from "./bookingWidget.module.css"

export function preload() {
  void getLocations()
}

export default async function BookingWidget() {
  const locations = await getLocations()

  if (!locations || "error" in locations) {
    return null
  }

  return (
    <section className={styles.container}>
      <Form locations={locations.data} />
    </section>
  )
}
