import {
    WeaPopoverHrm,
    WeaLocaleProvider
} from 'ecCom';
import {
    WeaLogView
} from 'comsMobx';
import loadjs from 'loadjs';
const WeaLogViewComp = WeaLogView.Component;
const {
    LogStore
} = WeaLogView;

class Home extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            visible: false,
            logStore: new LogStore(),
            logType: '3',
            logSmallType: ''
        }
        window.setLogViewProps = this.setLogViewProps;
    }

    componentDidMount() {
        loadjs(["/social/js/drageasy/drageasy.js", "/social/js/bootstrap/js/bootstrap.js?v=20171218", "/social/im/js/IMUtil_wev8.js", "/social/js/imcarousel/imcarousel.js"]);
    }

    setLogViewProps = (props) => {
        this.setState({
            targetId: '',
            visible: true,
            logStore: new LogStore(),
            logType: '3',
            ...props,
        });
    }

    onCancel = (props) => {
        this.setState({
            visible: false,
        });
    }

    render() {
        return (
            <div style={{height:"100%"}}>
                <iframe id="hiddenPreLoaderSingle" name="hiddenPreLoaderSingle" style={{display: "none"}} width="0" height="0" border="0" frameborder="0"></iframe>
                <WeaLocaleProvider ecId={`${this && this.props && this.props.ecId || ''}_WeaLocaleProvider@0dexv1`}>
                {this.props.children}
                </WeaLocaleProvider>
               <WeaPopoverHrm ecId={`${this && this.props && this.props.ecId || ''}_WeaPopoverHrm@52svxg`}/> 
               <WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@yz2ie3`} {...this.state} onCancel={this.onCancel}/>
            </div>
        )
    }
}

export default Home