import type { NextPage } from 'next'
import { GroupProvider } from '../../components/contexts/GroupProvider'
import { getServerSidePropsGroupProvider, PropsGroupProvider } from '../../src/getServerSideProps'
import { PageDetails } from '../../components/visualize/PageDetails'
import { useEffect } from 'react'

const Page: NextPage<PropsGroupProvider> = ({ id, ...initial }) => {
  useEffect(() => {
    document.body.classList.add('scroll')
    return () => document.body.classList.remove('scroll')
  }, [])

  return (
    <GroupProvider id={id} initial={initial}>
      <PageDetails />
    </GroupProvider>
  )
}

export const getServerSideProps = getServerSidePropsGroupProvider

export default Page
