import VodsList from '@/app/components/vods-list';
import { getVods } from '@/app/lib/vods';
import Pager from '@/app/components/pager';

interface IPageParams {
  params: {
    page: number; 
  };
}

export default async function Page({ params: { page } }: IPageParams) {
  
  const pageSize = 24
  const { count, vods } = await getVods(page, pageSize, true);


  return (
    <>
      <h2 className='title is-2'>Latest VODs</h2>
      <p className='subtitle'>page {page}</p>
      <VodsList vods={vods} page={page} pageSize={pageSize} />
      <Pager
        baseUrl='/latest-vods'
        page={page}
        pageCount={Math.floor(count/pageSize)}
      />
    </>
  );
}
