import { FC, Suspense } from 'react';
import { Main } from './ui/Main';
import HomePage from './ui/HomePage';
import { MonthCardSkeleton } from './ui/MonthCardSkeleton';

export interface PageProps {
  searchParams?: {
    year?: string;
    month?: string;
  };
}

const HomePageSkeleton = () => 
<>
  <MonthCardSkeleton checked={true} />
  <MonthCardSkeleton />
  <MonthCardSkeleton />
</>

const Page:FC<PageProps> = async ({ searchParams }) => {

 return (
    <Main>
      <Suspense fallback={<HomePageSkeleton />}>
        <HomePage searchParams={searchParams} />
      </Suspense>
    </Main>
  );
}

export default Page;