import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Container } from '@redux-devtools/ui';
import SliderMonitor from './monitors/Slider';
import { liftedDispatch, getReport } from '../actions';
import { getActiveInstance } from '../reducers/instances';
import DevTools from '../containers/DevTools';
import Dispatcher from './monitors/Dispatcher';
import TopButtons from '../components/TopButtons';
import BottomButtons from '../components/BottomButtons';
class Actions extends Component {
  render() {
    const {
      monitor,
      dispatcherIsOpen,
      sliderIsOpen,
      options,
      liftedState,
      liftedDispatch,
      stateTreeSettings
    } = this.props;
    return /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(TopButtons, {
      dispatch: liftedDispatch,
      liftedState: liftedState,
      options: options
    }), /*#__PURE__*/React.createElement(DevTools, {
      monitor: monitor,
      liftedState: liftedState,
      monitorState: this.props.monitorState,
      dispatch: liftedDispatch,
      features: options.features,
      stateTreeSettings: stateTreeSettings
    }), sliderIsOpen && options.connectionId && options.features.jump && /*#__PURE__*/React.createElement(SliderMonitor, {
      liftedState: liftedState,
      dispatch: liftedDispatch
    }), dispatcherIsOpen && options.connectionId && options.features.dispatch && /*#__PURE__*/React.createElement(Dispatcher, {
      options: options
    }), /*#__PURE__*/React.createElement(BottomButtons, {
      dispatcherIsOpen: dispatcherIsOpen,
      sliderIsOpen: sliderIsOpen,
      options: options
    }));
  }
}
const mapStateToProps = state => {
  const instances = state.instances;
  const id = getActiveInstance(instances);
  return {
    liftedState: instances.states[id],
    monitorState: state.monitor.monitorState,
    options: instances.options[id],
    monitor: state.monitor.selected,
    dispatcherIsOpen: state.monitor.dispatcherIsOpen,
    sliderIsOpen: state.monitor.sliderIsOpen,
    reports: state.reports.data,
    stateTreeSettings: state.stateTreeSettings
  };
};
const actionCreators = {
  liftedDispatch,
  getReport
};
export default connect(mapStateToProps, actionCreators)(Actions);