import {
	observer
} from 'mobx-react';
import {
	WeaDialog,
} from 'ecCom';
import {
	Loading,
} from '../../public/learn';
import DialogForm from './DialogForm';

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

	render() {
		const {
			store
		} = this.props, {
			DIALOG,
			dialog,
			dialogButtons,
		} = store;

		return (
			<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@czsk0a`}
				{...DIALOG}
				{...dialog}
				buttons={dialogButtons}
			>
				{
					dialog.loading ? <Loading ecId={`${this && this.props && this.props.ecId || ''}_Loading@wibicp`} /> :	<DialogForm ecId={`${this && this.props && this.props.ecId || ''}_DialogForm@0gz6yk`} store={store}/>
				}
			</WeaDialog>
		);
	}
}