import { useState, useEffect } from 'react';
import { connect } from '@umijs/max';
import { ConfigProvider } from 'antd';
import PagesMainJobseekerListTable from '@/components/Render/Main/Jobseeker/List/table'
import PagesMainJobseekerListCreate from '@/components/Render/Main/Jobseeker/List/create'
import PagesMainJobseekerListRegister from '@/components/Render/Main/Jobseeker/List/register'
import PagesMainJobseekerListExport from '@/components/Render/Main/Jobseeker/List/export'
import PagesMainJobseekerListDetail from '@/components/Render/Main/Jobseeker/List/detail'
import PagesMainJobseekerListHelp from '@/components/Render/Main/Jobseeker/List/help'

const JobseekerListPage: React.FC = ({ dispatch, openModel }: any) => {
    const [id, setId] = useState<object>(null);
    const getId = (value: number) => {
        setId(value)
    }

    useEffect(() => {
        if (!openModel.openModal) {
            setId(0)
        }
    }, [openModel.openModal])

    return (
        <>
            <ConfigProvider
                theme={{
                    token: {
                        colorPrimary: '#4FBE70',
                    }
                }}
            >
                <PagesMainJobseekerListTable getId={getId}></PagesMainJobseekerListTable>
                <PagesMainJobseekerListCreate id={id}></PagesMainJobseekerListCreate>
                <PagesMainJobseekerListRegister id={id}></PagesMainJobseekerListRegister>
                <PagesMainJobseekerListExport id={id}></PagesMainJobseekerListExport>
                <PagesMainJobseekerListDetail id={id}></PagesMainJobseekerListDetail>
                <PagesMainJobseekerListHelp id={id}></PagesMainJobseekerListHelp>

            </ConfigProvider>
        </>
    );
};


export default connect(({ openModel }: any) => ({
    openModel
}))(JobseekerListPage);