import pb from "@/lib/pocketbase"; import { waitinglistValidationSchema } from "@/utils/form"; import { yupResolver } from "@hookform/resolvers/yup"; import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import Icon from "@/components/Icon"; import colors, { hexToRgb } from "@/utils/colors"; import Footer from "@/components/Footer"; import { useTheme } from "next-themes"; import Background from "@/components/Utilities/Background"; const WaitingListWithImageHero = () => { const { theme } = useTheme(); const backgroundColor = hexToRgb(colors[theme ?? "light"]["base-100"]); const { register, handleSubmit, formState: { errors }, } = useForm({ resolver: yupResolver(waitinglistValidationSchema), }); const onSubmit = async (data: { firstName: string; lastName: string; email: string; }) => { try { await pb.collection("contact").create({ source: "waitinglist", ...data }); localStorage.setItem("waitinglist", JSON.stringify(data)); } catch (error) { console.log("heya"); } }; return (

Bethel Farms

{typeof window !== "undefined" && !localStorage.getItem("waitinglist") ? ( <>

Get notified when we launch

{errors.firstName?.message} 
{errors.lastName?.message} 
{errors.email?.message} 
) : (

You are on our waiting list. We will be in touch!

)}