import type { NextPage } from 'next'
import { Home } from '../components/home/Home'
import { GroupProvider } from '../components/contexts/GroupProvider'
import { getServerSidePropsGroupProvider, PropsGroupProvider } from '../src/getServerSideProps'
import Head from 'next/head'
import { useIntl } from 'react-intl'
import { i18n } from '../components/shared/I18n/I18n'

const Page: NextPage<PropsGroupProvider> = ({ id, ...initial }) => {
  const intl = useIntl()
  return (
    <GroupProvider id={id} initial={initial}>
      <Head>
        <title>{i18n(intl, 'page.home.head.title')}</title>
        <meta name='description' content={i18n(intl, 'page.home.head.meta.description')} />
      </Head>
      <Home />
    </GroupProvider>
  )
}

export const getServerSideProps = getServerSidePropsGroupProvider

export default Page
