import {
	inject,
	observer
} from 'mobx-react';
import {
	WeaTop,
	WeaRightMenu,
} from 'ecCom';

import InitForm from './InitForm';
import AnalysisResult from './AnalysisResult';

@inject('hrmInit')
@observer
class Top extends React.Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {
		this.props.hrmInit.getRightMenu();
	}

	render() {
		const {
			topProps,
			toploading,
			topButtons,
			dropMenuDatas,
			hasInit,
		} = this.props.hrmInit;

		return (
			<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@ff4n4w`} 
               {...topProps}
               loading={toploading}
               buttons={topButtons}
               dropMenuDatas={dropMenuDatas}
            >
            	<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@g1rp54`} datas={dropMenuDatas}>
            		{
            			hasInit ? <AnalysisResult ecId={`${this && this.props && this.props.ecId || ''}_AnalysisResult@zfqlrg`} /> : <InitForm ecId={`${this && this.props && this.props.ecId || ''}_InitForm@yq1l4h`} />
            		}
            	</WeaRightMenu>
            </WeaTop>
		);
	}

}

export default Top;