import React from 'react';
import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store';
import MapComponent from '@/components/mapView/ArcgisMap';
import { store } from 'microser-data';
import style from './index.less';

class CreateMap extends React.Component {
  constructor(props) {
    super(props);
    this.mapManganerRef = React.createRef();
  }

  state = {
    loading: true,
    config: window.globalConfig.mapsettings,
    widgets: window.globalConfig.uiwidgets,
  };

  getView = view => {
    this.props.updageMapView(view);

  };

  render() {
    return (
      <>
        <MapComponent {...this.state} getViewInfo={this.getView} ref={this.mapManganerRef}/>
      </>
    );
  }
}

const mapStateToProps = state => ({});

const mapDispatchToProps = dispatch => ({
  updageMapView(mapView) {
    dispatch(actionCreators.updageMapView(mapView));
  },
});

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(CreateMap);
