'use client'

/* import { useGetHome, useUpdateSection } from '@/hooks'
import HomeMetaPanel from '@/views/home/HomeMetaPanel'
import HomeSectionPanel from '@/views/home/HomeSectionPanel' */
import { Button, Typography } from '@mui/material'

export default function HomePageView() {
  /*   const { data, refetch, isFetching } = useGetHome()
  const sections = data?.data?.sections || []
  const page = data?.data?.page */

  // wire the update hook with the current page id
  /*   const { mutateAsync: updateMeta } = useUpdateSection(page?.id || '')
   */
  return (
    <div className='p-6 space-y-6'>
      <div className='flex items-center justify-between'>
        <div>
          <Typography variant='h5'>Home Page</Typography>
        </div>
        {/*   <Button onClick={() => refetch()} disabled={isFetching} variant='outlined'>
          {isFetching ? 'Refreshing…' : 'Refresh'}
        </Button> */}
      </div>

      {/*  {page && (
        <HomeMetaPanel
          page={page}
          onSave={async payload => {
            await updateMeta(payload) // PUT the meta update
            await refetch() // refresh the page data
          }}
        />
      )}

      <div className='grid grid-cols-1 gap-6'>
        {sections?.map((s: any) => <HomeSectionPanel key={s?.id} section={s} onUpdated={() => refetch()} />)}
      </div> */}
    </div>
  )
}
