import React, {
	Component
} from 'react';
import {
	observer
} from 'mobx-react';
import {
	WeaDialog,
	WeaSearchGroup,
	WeaRightMenu,
	WeaNewScroll
} from 'ecCom';
import ImportResource from '../../importresource/Import';
import {
	i18n
} from '../../../public/i18n';

@observer
export default class Import extends Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {}

	componentWillReceiveProps(nextProps) {}

	render() {
		const {
			store
		} = this.props;
		const {
			dialogParams,
			getDialogOpButtons,
			editorDialogRightMenu,
			message
		} = store;
		const dProps = {
			...dialogParams,
			buttons: getDialogOpButtons()
		}

		let children = [];
		if (message.length > 0) {
			message.map(m => {
				children.push(<div>{m}</div>)
			})
		}
		const msgCom = <div style={{color: 'red'}}>{children}</div>;
		return (
			<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@ho98sx`} {...dProps}>
            	<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@r8xsrr`} datas={editorDialogRightMenu}>
            		<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@5kfupl`} height={'100%'}>
	            		<ImportResource ecId={`${this && this.props && this.props.ecId || ''}_ImportResource@afnhmx`}/>
	            		{
							message.length > 0 && 
							<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@fz2zfq`} col={1} showGroup={true} title={i18n.label.promptInformation()} items={[{com:msgCom}]}/>
						}
					</WeaNewScroll>
            	</WeaRightMenu>
            </WeaDialog>
		)
	}
}