import React from 'react'
import { ContactSectionBlock, ContactSectionBlockPage } from './Component.client'
import { getGlobal } from '@/lib/utils/getGlobal'
import { ContactForm } from '@/payload-types'
import { getCurrentLocale } from '@/locales/server'

export async function ContactSectionForm({ isPage = false }: { isPage?: boolean }) {
  const locale = await getCurrentLocale()
  const ContactSectionData: ContactForm = (await getGlobal('contactForm', 1, locale)) as ContactForm
  const socialData = await getGlobal('footer', 1,)

  return isPage ? <ContactSectionBlockPage {...ContactSectionData} {...socialData} /> : <ContactSectionBlock {...ContactSectionData} />
}
