import {FC} from 'react';
import {context, pageContext, useContextReducer} from './context';
import {PageProvider} from '@components';
import {ChildrenFC} from '@utils';
import Filter from './filter';
import TableList from './table';

const MenuProvider: ChildrenFC = function({children}) {
  const state = useContextReducer();

  const {Provider} = context;

  return <Provider value={state}>{children}</Provider>;
};

const PdaMenu: FC = function() {
  return (
    <MenuProvider>
      <PageProvider context={pageContext}>
        <main className='content-main'>
          <Filter />
          <TableList />
        </main>
      </PageProvider>
    </MenuProvider>
  );
};

export default PdaMenu;
