import { useState, useEffect} from 'react';
import { connect } from '@umijs/max';
import { ConfigProvider } from 'antd';
import PagesSettingSystemTable from '@/components/Render/Setting/System/table'
import PagesSettingSystemCreate from '@/components/Render/Setting/System/create'

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

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

    return (
        <>
            <ConfigProvider
                theme={{
                    token: {
                        colorPrimary: '#4FBE70',
                    }
                }}
            >
                <PagesSettingSystemTable getId={getId}></PagesSettingSystemTable>
                <PagesSettingSystemCreate id={id}></PagesSettingSystemCreate>
            </ConfigProvider>
        </>
    );
};

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

