import {
	observer
} from 'mobx-react';
import {
	WeaBrowser
} from 'ecCom';
import Form from './Form';
import Tab from './Tab';
import Table from './Table';

@observer
export default class Content extends React.Component {
	constructor(props) {
		super(props);
	}

	render() {
		const {
			store
		} = this.props, {
			hasTab,
			tab,
			pageForm,
			BROWSER,
		} = store, {
			selectedKey
		} = tab;

		let c;
		if (selectedKey === '0') {
			c = <Form ecId={`${this && this.props && this.props.ecId || ''}_Form@stpeqz`} datas={pageForm}/>;
		} else {
			c = (
				<div>
					<Table ecId={`${this && this.props && this.props.ecId || ''}_Table@t4b8k8`} store={store}/>
					<div className='hidden'>
						<WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@2zt97k`} 
							{...BROWSER}
						/>
					</div>
				</div>
			);
		}

		return (
			<div>
				{
					hasTab && <Tab ecId={`${this && this.props && this.props.ecId || ''}_Tab@5o3dio`} store={store} />
				}
				{c}
			</div>
		);
	}
}