import { useState, useEffect} from 'react';
import { connect } from '@umijs/max';
import { ConfigProvider } from 'antd';
import PagesSettingOtherTable from '@/components/Render/Setting/Other/table'
import PagesSettingOtherCreate from '@/components/Render/Setting/Other/create'

const SettingOtherPage: 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',
                    }
                }}
            >
                <PagesSettingOtherTable getId={getId}></PagesSettingOtherTable>
                <PagesSettingOtherCreate id={id}></PagesSettingOtherCreate>
            </ConfigProvider>
        </>
    );
};

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

