import React from 'react';
import { Spin } from 'antd';

import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store';
import MapComponent from '@/components/mapView';

import style from './baseMapPage.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} getMapInfo={this.getView} />
      </>
    );
  }
}

const mapStateToProps = state => ({});

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

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